summaryrefslogtreecommitdiff
path: root/cpp/src/tests/cluster_test.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-10-17 16:13:13 +0000
committerAlan Conway <aconway@apache.org>2008-10-17 16:13:13 +0000
commita039e57108ed06586e73a255dc824ed27fc6de2a (patch)
tree22683a3561307ab6ccfa6ba1107a4e5e4c7a0b9e /cpp/src/tests/cluster_test.cpp
parent1a0e5ee95bbc32a78daeed9e6538921a9b86157d (diff)
downloadqpid-python-a039e57108ed06586e73a255dc824ed27fc6de2a.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/qpid@705661 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/cluster_test.cpp')
-rw-r--r--cpp/src/tests/cluster_test.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/cpp/src/tests/cluster_test.cpp b/cpp/src/tests/cluster_test.cpp
index 9266aa1b67..68920d1324 100644
--- a/cpp/src/tests/cluster_test.cpp
+++ b/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));