Просмотр исходного кода

CTS: fix test_agent start/stop errors

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2813 fd59a12c-fef9-0310-b244-a6a79926bd2f
Angus Salkeld 15 лет назад
Родитель
Сommit
48aff01d75
2 измененных файлов с 15 добавлено и 8 удалено
  1. 11 5
      cts/corosync.py
  2. 4 3
      cts/corotests.py

+ 11 - 5
cts/corosync.py

@@ -449,7 +449,7 @@ class TestAgent(object):
         try:
         try:
             sent = self.sock.send (real_msg)
             sent = self.sock.send (real_msg)
         except socket.error, msg:
         except socket.error, msg:
-            print msg
+            self.env.debug("send(%s): %s; error: %s" % (self.node, real_msg, msg))
 
 
         if sent == 0:
         if sent == 0:
             raise RuntimeError ("socket connection broken")
             raise RuntimeError ("socket connection broken")
@@ -468,7 +468,14 @@ class TestAgent(object):
 
 
     def send_recv_dynamic (self, *args):
     def send_recv_dynamic (self, *args):
         self.send_dynamic (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):
     def send_dynamic (self, *args):
         if not self.started:
         if not self.started:
@@ -480,12 +487,11 @@ class TestAgent(object):
             a_str = str(a)
             a_str = str(a)
             real_msg += ":" + str (len (a_str)) + ":" + a_str
             real_msg += ":" + str (len (a_str)) + ":" + a_str
         real_msg += ";"
         real_msg += ";"
-        #print "CLIENT:" + real_msg
         sent = 0
         sent = 0
         try:
         try:
             sent = self.sock.send (real_msg)
             sent = self.sock.send (real_msg)
         except socket.error, msg:
         except socket.error, msg:
-            print msg
+            self.env.debug("send_dynamic(%s): %s; error: %s" % (self.node, real_msg, msg))
 
 
         if sent == 0:
         if sent == 0:
             raise RuntimeError ("socket connection broken")
             raise RuntimeError ("socket connection broken")
@@ -539,7 +545,7 @@ class CpgTestAgent(TestAgent):
                 self.cpg_finalize()
                 self.cpg_finalize()
         except RuntimeError, msg:
         except RuntimeError, msg:
             # if cpg_agent is down, we are not going to stress
             # if cpg_agent is down, we are not going to stress
-            print msg
+            self.env.debug("CpgTestAgent::cpg_finalize() - %s" % msg)
 
 
         TestAgent.stop(self)
         TestAgent.stop(self)
 
 

+ 4 - 3
cts/corotests.py

@@ -76,6 +76,9 @@ class CoroTest(CTSTest):
             if self.need_all_up and not self.CM.StataCM(n):
             if self.need_all_up and not self.CM.StataCM(n):
                 self.incr("started")
                 self.incr("started")
                 self.start(n)
                 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):
             if not self.need_all_up and self.CM.StataCM(n):
                 self.incr("stopped")
                 self.incr("stopped")
                 self.stop(n)
                 self.stop(n)
@@ -93,6 +96,7 @@ class CpgContextTest(CoroTest):
     def __init__(self, cm):
     def __init__(self, cm):
         CoroTest.__init__(self, cm)
         CoroTest.__init__(self, cm)
         self.name="CpgContextTest"
         self.name="CpgContextTest"
+        self.CM.start_cpg = True
 
 
     def __call__(self, node):
     def __call__(self, node):
         self.incr("calls")
         self.incr("calls")
@@ -119,9 +123,6 @@ class CpgConfigChangeBase(CoroTest):
         self.listener = None
         self.listener = None
         self.wobbly = None
         self.wobbly = None
         for n in self.CM.Env["nodes"]:
         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:
             if self.wobbly is None:
                 self.wobbly = n
                 self.wobbly = n
             elif self.listener is None:
             elif self.listener is None: