Commit 41107678 authored by Jérome Perrin's avatar Jérome Perrin

test_check_url_available: wait for our test HTTP server to be available

parent 56b5df0e
......@@ -29,6 +29,7 @@ from slapos.grid.promise import PromiseError
from slapos.test.promise.plugin import TestPromisePluginMixin
from slapos.util import str2bytes
import contextlib
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
......@@ -42,6 +43,7 @@ import json
import multiprocessing
import os
import six
import socket
import ssl
import tempfile
import time
......@@ -192,6 +194,12 @@ class CheckUrlAvailableMixin(TestPromisePluginMixin):
cls.server_process = multiprocessing.Process(target=server)
cls.server_process.start()
for _ in range(20):
try:
with contextlib.closing(socket.create_connection((SLAPOS_TEST_IPV4, SLAPOS_TEST_IPV4_PORT))):
break
except Exception:
time.sleep(.1)
@classmethod
def tearDownClass(cls):
......
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