[PATCH] openbsc[master]: vty tests: nat_msc_test(): retry thrice for socket timeout

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Sep 26 01:02:01 UTC 2016


Review at  https://gerrit.osmocom.org/945

vty tests: nat_msc_test(): retry thrice for socket timeout

The build server often hits below timeout by random, so let's give it three
retries:

ERROR: testBSCreload (__main__.TestVTYNAT)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./vty_test_runner.py", line 782, in testBSCreload
    msc = nat_msc_test(self, ip, port)
  File "./vty_test_runner.py", line 1237, in nat_msc_test
    conn, addr = msc.accept()
  File "/usr/lib/python2.7/socket.py", line 202, in accept
    sock, addr = self._sock.accept()
timeout: timed out

Change-Id: I8e1023f6ddd913f95402bb4afb8d02dccda17533
---
M openbsc/tests/vty_test_runner.py
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/45/945/1

diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index 00eae70..cb6e1ed 100644
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -1233,8 +1233,17 @@
     msc.listen(5)
     if (verbose):
         print "MSC is ready at " + ip
+    timeout_retries = 3;
     while "MSC is connected: 0" == x.vty.command("show msc connection"):
-        conn, addr = msc.accept()
+	try:
+	    conn, addr = msc.accept()
+	except socket.timeout:
+	    # The build server hits this timeout every now and then. The
+	    # timeout is long, but let's give it a couple of retries.
+	    if timeout_retries < 1:
+		raise
+	    timeout_retries -= 1
+	    continue
         if (verbose):
             print "MSC got connection from ", addr
     return conn

-- 
To view, visit https://gerrit.osmocom.org/945
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e1023f6ddd913f95402bb4afb8d02dccda17533
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list