Skip to content

Commit 4525336

Browse files
pyalexadchia
authored andcommitted
fix: Python server is not correctly starting in integration tests (#2706)
Signed-off-by: Oleksii Moskalenko <[email protected]>
1 parent 156c6f1 commit 4525336

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

sdk/python/tests/conftest.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,11 @@ def pytest_generate_tests(metafunc: pytest.Metafunc):
274274

275275
@pytest.fixture(scope="session")
276276
def python_server(environment):
277+
assert not _check_port_open("localhost", environment.get_local_server_port())
278+
277279
proc = Process(
278280
target=start_test_local_server,
279281
args=(environment.feature_store.repo_path, environment.get_local_server_port()),
280-
daemon=True,
281282
)
282283
if (
283284
environment.python_feature_server
@@ -298,6 +299,15 @@ def python_server(environment):
298299
if proc.is_alive():
299300
proc.kill()
300301

302+
# wait server to free the port
303+
wait_retry_backoff(
304+
lambda: (
305+
None,
306+
not _check_port_open("localhost", environment.get_local_server_port()),
307+
),
308+
timeout_secs=30,
309+
)
310+
301311

302312
def _check_port_open(host, port) -> bool:
303313
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:

0 commit comments

Comments
 (0)