Skip to content

Commit

Permalink
Add timeout and use http response for checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Wh1isper committed Nov 14, 2023
1 parent 09c36b9 commit b718c8c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ classifiers = [
'Programming Language :: Python :: 3.11',
]
[project.optional-dependencies]
test = ["pytest", "pytest-cov", "pytest-asyncio", "httpx", "docker"]
test = ["pytest", "pytest-cov", "pytest-asyncio","pytest-timeout", "httpx", "docker"]
docs = ["Sphinx<=7.2.4", "sphinx-rtd-theme", "sphinx-click", "autodoc_pydantic"]

[project.scripts]
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[pytest]
asyncio_mode = auto

timeout = 60
5 changes: 3 additions & 2 deletions tests/test_jaeger_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import time
from collections import namedtuple

import httpx
import pytest

import docker
Expand Down Expand Up @@ -72,8 +73,8 @@ def jaeger_container(docker_client: docker.DockerClient, service_id, data_t):
# Waiting for the container to start by query ui_port
while True:
try:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect(("127.0.0.1", ui_port))
response = httpx.get(f"http://127.0.0.1:{ui_port}")
if response.status_code == 200:
break
except:
time.sleep(0.1)
Expand Down

0 comments on commit b718c8c

Please sign in to comment.