From 48aff01d7536bc3b8146a026f475ff34c8d9a7c5 Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Wed, 12 May 2010 09:25:18 +0000 Subject: [PATCH] CTS: fix test_agent start/stop errors git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2813 fd59a12c-fef9-0310-b244-a6a79926bd2f --- cts/corosync.py | 16 +++++++++++----- cts/corotests.py | 7 ++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/cts/corosync.py b/cts/corosync.py index 79f44705..84323739 100644 --- a/cts/corosync.py +++ b/cts/corosync.py @@ -449,7 +449,7 @@ class TestAgent(object): try: sent = self.sock.send (real_msg) except socket.error, msg: - print msg + self.env.debug("send(%s): %s; error: %s" % (self.node, real_msg, msg)) if sent == 0: raise RuntimeError ("socket connection broken") @@ -468,7 +468,14 @@ class TestAgent(object): def send_recv_dynamic (self, *args): self.send_dynamic (args) - return self.read() + + try: + res = self.read () + except RuntimeError, msg: + self.env.log("send_recv_dynamic: %s; error: %s" % (str(real_msg), msg)) + + return res + def send_dynamic (self, *args): if not self.started: @@ -480,12 +487,11 @@ class TestAgent(object): a_str = str(a) real_msg += ":" + str (len (a_str)) + ":" + a_str real_msg += ";" - #print "CLIENT:" + real_msg sent = 0 try: sent = self.sock.send (real_msg) except socket.error, msg: - print msg + self.env.debug("send_dynamic(%s): %s; error: %s" % (self.node, real_msg, msg)) if sent == 0: raise RuntimeError ("socket connection broken") @@ -539,7 +545,7 @@ class CpgTestAgent(TestAgent): self.cpg_finalize() except RuntimeError, msg: # if cpg_agent is down, we are not going to stress - print msg + self.env.debug("CpgTestAgent::cpg_finalize() - %s" % msg) TestAgent.stop(self) diff --git a/cts/corotests.py b/cts/corotests.py index a3d0dc70..a16828ca 100644 --- a/cts/corotests.py +++ b/cts/corotests.py @@ -76,6 +76,9 @@ class CoroTest(CTSTest): if self.need_all_up and not self.CM.StataCM(n): self.incr("started") self.start(n) + if self.need_all_up and self.CM.start_cpg: + self.CM.cpg_agent[n].clean_start() + self.CM.cpg_agent[n].cpg_join(self.name) if not self.need_all_up and self.CM.StataCM(n): self.incr("stopped") self.stop(n) @@ -93,6 +96,7 @@ class CpgContextTest(CoroTest): def __init__(self, cm): CoroTest.__init__(self, cm) self.name="CpgContextTest" + self.CM.start_cpg = True def __call__(self, node): self.incr("calls") @@ -119,9 +123,6 @@ class CpgConfigChangeBase(CoroTest): self.listener = None self.wobbly = None for n in self.CM.Env["nodes"]: - if self.CM.start_cpg: - self.CM.cpg_agent[n].clean_start() - self.CM.cpg_agent[n].cpg_join(self.name) if self.wobbly is None: self.wobbly = n elif self.listener is None: