bpd tests: terminate server upon connection failure
@@ -310,6 +310,7 @@ class BPDTestHelper(unittest.TestCase, TestHelper):
], assigned_port))
server.start()
+ try:
# Wait until the socket is connected:
for _ in range(20):
if assigned_port.value != 0:
@@ -318,13 +319,14 @@ class BPDTestHelper(unittest.TestCase, TestHelper):
break
time.sleep(0.01)
else:
- raise RuntimeError('Timed out waiting for the BPD server')
+ raise RuntimeError(
+ 'Timed out waiting for the BPD server to start'
+ )
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host, port))
sock2 = None
- try:
if second_client:
sock2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock2.connect((host, port))
