Zhou Zheng Sheng has uploaded a new change for review. Change subject: sslTests: fix parallel build in Jenkins ......................................................................
sslTests: fix parallel build in Jenkins sslTests uses a fixed port for binding socket. When it is run in parallel Jenkins builds, it will fail with port conflicts. This patch tries to find new available port if the default port is occupied. Change-Id: Ia8510eb418de1b045d362231dee24a994ca936ac Signed-off-by: Zhou Zheng Sheng <[email protected]> --- M tests/sslTests.py 1 file changed, 19 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/9254/1 diff --git a/tests/sslTests.py b/tests/sslTests.py index 1216acc..a9dc396 100644 --- a/tests/sslTests.py +++ b/tests/sslTests.py @@ -24,6 +24,7 @@ import tempfile import threading import subprocess +import errno import testrunner import SecureXMLRPCServer @@ -104,12 +105,28 @@ keyfile=self.keyfile, certfile=self.certfile, ca_certs=self.certfile) - self.server.bind(ADDRESS) + self.address = self.tryBind(ADDRESS) self.server.listen(5) # Start the server thread: self.thread = SSLServerThread(self.server) self.thread.start() + + def tryBind(self, address): + ipadd, port = address + while True: + try: + self.server.bind((ipadd, port)) + return (ipadd, port) + except socket.error as ex: + if ex.errno == errno.EADDRINUSE: + port += 1 + if port > 65535: + raise socket.error( + errno.EADDRINUSE, + "Can not find available port to bind") + else: + raise def tearDown(self): """Release the resources used by the tests. @@ -152,7 +169,7 @@ command = [ "openssl", "s_client", - "-connect", "%s:%d" % ADDRESS, + "-connect", "%s:%d" % self.address, ] if args: command += args -- To view, visit http://gerrit.ovirt.org/9254 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia8510eb418de1b045d362231dee24a994ca936ac Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
