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
Pipeline #11433 failed with stage
in 0 seconds
...@@ -29,6 +29,7 @@ from slapos.grid.promise import PromiseError ...@@ -29,6 +29,7 @@ from slapos.grid.promise import PromiseError
from slapos.test.promise.plugin import TestPromisePluginMixin from slapos.test.promise.plugin import TestPromisePluginMixin
from slapos.util import str2bytes from slapos.util import str2bytes
import contextlib
from cryptography import x509 from cryptography import x509
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives import hashes
...@@ -42,6 +43,7 @@ import json ...@@ -42,6 +43,7 @@ import json
import multiprocessing import multiprocessing
import os import os
import six import six
import socket
import ssl import ssl
import tempfile import tempfile
import time import time
...@@ -192,6 +194,12 @@ class CheckUrlAvailableMixin(TestPromisePluginMixin): ...@@ -192,6 +194,12 @@ class CheckUrlAvailableMixin(TestPromisePluginMixin):
cls.server_process = multiprocessing.Process(target=server) cls.server_process = multiprocessing.Process(target=server)
cls.server_process.start() 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)
Please register or sign in to reply
@classmethod @classmethod
def tearDownClass(cls): 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