make cross-check-tcp more robust : we need to wait for network presence on both ends...
[tests.git] / system / TestSliver.py
index f69e4c5..e4f49f7 100644 (file)
@@ -38,28 +38,22 @@ class TestSliver:
         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 check_tcp_ready (self, port):
+        ready_command = "./tcptest.py ready -p %d"%(port)
+        return self.test_ssh.copy("tcptest.py") == 0 and \
+            self.test_ssh.run(ready_command) == 0
+
     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
 
-    def check_tcp_ready (self, port):
-        server_command = "./tcptest.py ready -p %d"%(port)
-        return self.test_ssh.copy("tcptest.py") == 0 and \
-            self.test_ssh.run(server_command) == 0
-
     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
-        # allow for 2 attempts
-        attempts = 2
-        for attempt in range (attempts):
-            if attempt != 0:
-                time.sleep(retry)
-            utils.header ("tcp client - attempt # %s" % (attempt+1))
-            if self.test_ssh.run(client_command) == 0:
-                return True
+        if self.test_ssh.run(client_command) == 0:
+            return True
         return False
 
     # use the node's main ssh root entrance, as the slice entrance might be down