Commit e7ca6787 authored by Bryton Lacquement's avatar Bryton Lacquement 🚪

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 c28fe4ba
...@@ -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