Commit 7b0ad5f4 authored by Bryton Lacquement's avatar Bryton Lacquement 🚪 Committed by Matevz Golob

qa: use the SO_REUSEADDR flag in functional tests' WSGI server

It was possible that the previous server socket did not have enough time
to expire, which could cause an "Address already in use" exception.
parent c12c2805
...@@ -151,7 +151,9 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase): ...@@ -151,7 +151,9 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
for ip, port in parseListeningAddress(zserver): for ip, port in parseListeningAddress(zserver):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try: try:
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((ip, port)) s.bind((ip, port))
s.listen(0)
except socket.error as e: except socket.error as e:
s.close() s.close()
if e[0] != errno.EADDRINUSE: if e[0] != errno.EADDRINUSE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment