diff options
| author | Alan Conway <aconway@apache.org> | 2008-10-17 16:13:13 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-10-17 16:13:13 +0000 |
| commit | 3104d778e1352e9a3a142d8c133a115c847360c2 (patch) | |
| tree | 561b18cf88619fbc700e90b14829bb2e45516631 /qpid/cpp/src/tests/cluster_test.cpp | |
| parent | d7742b5c2cd6b8aa0c2a12c105c9dcac81401d3a (diff) | |
| download | qpid-python-3104d778e1352e9a3a142d8c133a115c847360c2.tar.gz | |
Suppress logging expected errors in tests.
Improved log messages for connection, session errors.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@705661 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/cluster_test.cpp')
| -rw-r--r-- | qpid/cpp/src/tests/cluster_test.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/qpid/cpp/src/tests/cluster_test.cpp b/qpid/cpp/src/tests/cluster_test.cpp index 9266aa1b67..68920d1324 100644 --- a/qpid/cpp/src/tests/cluster_test.cpp +++ b/qpid/cpp/src/tests/cluster_test.cpp @@ -92,11 +92,19 @@ struct ClusterFixture : public vector<uint16_t> { void add0(bool force); void setup(); + /** Kill a forked broker with sig, or shutdown broker0 if n==0. */ void kill(size_t n, int sig=SIGINT) { if (n) forkedBrokers[n-1].kill(sig); else broker0->broker->shutdown(); } + /** Kill a broker and suppress errors from connection. */ + void killWithSilencer(size_t n, client::Connection& c, int sig=SIGINT) { + ScopedSuppressLogging sl; + kill(n,sig); + try { c.close(); } catch(...) {} + } + void waitFor(size_t n) { for (size_t retry = 1000; retry && getGlobalCluster().getUrls().size() != n; --retry) ::usleep(1000); @@ -218,7 +226,8 @@ QPID_AUTO_TEST_CASE(testConnectionKnownHosts) { BOOST_CHECK_EQUAL(kb2,kb0); BOOST_CHECK_EQUAL(kb2,kb1); - cluster.kill(1,9); + cluster.killWithSilencer(1,c1.connection,9); + cluster.waitFor(2); kb0 = knownBrokerPorts(c0.connection, 2); kb2 = knownBrokerPorts(c2.connection, 2); BOOST_CHECK_EQUAL(kb0.size(), 2u); @@ -257,13 +266,8 @@ QPID_AUTO_TEST_CASE(DumpConsumers) { BOOST_CHECK_EQUAL(c2.session.queueQuery("q").getMessageCount(), 0u); // Kill the subscribing member, ensure further messages are not removed. - { - ScopedSuppressLogging sl; - cluster.kill(1,9); - cluster.waitFor(2); - try { c1.connection.close(); } - catch (...) {} - } + cluster.killWithSilencer(1,c1.connection,9); + cluster.waitFor(2); for (int i = 0; i < 10; ++i) { c0.session.messageTransfer(arg::content=Message("bbb", "q")); BOOST_REQUIRE(c0.subs.get(m, "q", TIME_SEC)); |
