CTS: fix test_agent start/stop errors

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2813 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Angus Salkeld 2010-05-12 09:25:18 +00:00
parent 09615628b1
commit 48aff01d75
2 changed files with 15 additions and 8 deletions

View File

@ -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)

View File

@ -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: