cosmetic changes only
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Tue, 3 Mar 2015 10:37:34 +0000 (11:37 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Tue, 3 Mar 2015 10:37:34 +0000 (11:37 +0100)
+ a comment on the occasional issue with cross-check-tcp

system/TestPlc.py
system/TestSliver.py
system/utils.py

index 873b2fe..6b910a7 100644 (file)
@@ -1310,20 +1310,23 @@ class TestPlc:
         for spec in specs:
             port = spec['port']
             # server side
-            s_test_sliver = self.locate_sliver_obj_cross (spec['server_node'],spec['server_slice'],other_plcs)
-            if not s_test_sliver.run_tcp_server(port,timeout=20):
-                overall=False
+            # the issue here is that we have the server run in background
+            # and so we have no clue if it took off properly or not
+            # looks like in some cases it does not
+            s_test_sliver = self.locate_sliver_obj_cross (spec['server_node'], spec['server_slice'], other_plcs)
+            if not s_test_sliver.run_tcp_server(port, timeout=20):
+                overall = False
                 break
 
             # idem for the client side
-            c_test_sliver = self.locate_sliver_obj_cross (spec['client_node'],spec['client_slice'],other_plcs)
+            c_test_sliver = self.locate_sliver_obj_cross (spec['client_node'], spec['client_slice'], other_plcs)
             # use nodename from locatesd sliver, unless 'client_connect' is set
             if 'client_connect' in spec:
                 destination = spec['client_connect']
             else:
-                destination=s_test_sliver.test_node.name()
-            if not c_test_sliver.run_tcp_client(destination,port):
-                overall=False
+                destination = s_test_sliver.test_node.name()
+            if not c_test_sliver.run_tcp_client(destination, port):
+                overall = False
         return overall
 
     # painfully enough, we need to allow for some time as netflow might show up last
index e9aa7aa..a82b27b 100644 (file)
@@ -34,24 +34,24 @@ class TestSliver:
     def name (self):
         return "%s@%s"%(self.test_slice.name(),self.test_node.name())
 
-    def check_initscript_stamp(self,stamp):
-        utils.header("Checking for initscript stamp %s on sliver %s"%(stamp,self.name()))
+    def check_initscript_stamp(self, stamp):
+        utils.header("Checking for initscript stamp %s on sliver %s"%(stamp, self.name()))
         return self.test_ssh.run("ls -l /var/tmp/%s.stamp"%stamp)==0
     
-    def run_tcp_server (self,port,timeout=10):
+    def run_tcp_server (self, port, timeout=10):
         server_command = "./tcptest.py server -p %d -t %d"%(port,timeout)
         return self.test_ssh.copy("tcptest.py")==0 and \
-            self.test_ssh.run(server_command,background=True)==0
+            self.test_ssh.run(server_command, background=True)==0
 
-    def run_tcp_client (self,servername,port,retry=5):
-        client_command="./tcptest.py client -a %s -p %d"%(servername,port)
+    def run_tcp_client (self, servername, port, retry=5):
+        client_command="./tcptest.py client -a %s -p %d"%(servername, port)
         if self.test_ssh.copy("tcptest.py")!=0: return False
         utils.header ("tcp client - first attempt")
-        if self.test_ssh.run(client_command,background=False)==0: return True
+        if self.test_ssh.run(client_command, background=False)==0: return True
         # if first try has failed, wait for <retry> s an try again
         time.sleep(retry)
         utils.header ("tcp client - second attempt")
-        if self.test_ssh.run(client_command,background=False)==0: return True
+        if self.test_ssh.run(client_command, background=False)==0: return True
         return False
 
     # use the node's main ssh root entrance, as the slice entrance might be down
index 5a869d1..701ad3f 100644 (file)
@@ -22,8 +22,8 @@ def pprint(message,spec,depth=2):
 
 
 
-def system(command,background=False,silent=False, dry_run=None):
-    dry_run = dry_run if dry_run is not None else getattr(options,'dry_run',False)
+def system(command, background=False, silent=False, dry_run=None):
+    dry_run = dry_run if dry_run is not None else getattr(options, 'dry_run', False)
     if dry_run:
         print 'dry_run:',command
         return 0
@@ -59,7 +59,7 @@ def match (string, pattern):
     pattern=pattern.replace("?",".")
     return re.compile(pattern).match(string)
     
-def locate_hooks_scripts (message,path,extensions):
+def locate_hooks_scripts (message, path, extensions):
     print message,'searching',path,'for extensions',extensions
     scripts=[]
     for ext in extensions:
@@ -70,7 +70,7 @@ def locate_hooks_scripts (message,path,extensions):
 # quick & dirty - should probably use the parseroption object instead
 # and move to TestMain as well
 exclude_options_keys = [ 'ensure_value' , 'read_file', 'read_module' ]
-def show_options (message,options):
+def show_options (message, options):
     now=time.strftime("%H:%M:%S", time.localtime())
     print ">",now,"--",message
     for k in dir(options):