Adjust sleep times (#2080)

* Adjust sleep times

* Update test_start_container.py

* Update test_healthcheck.py

* Update pluto_check.py
This commit is contained in:
Ayaz Salikhov
2024-01-17 02:11:44 +04:00
committed by GitHub
parent 86dc0f274f
commit d57bf9590d
3 changed files with 17 additions and 23 deletions

View File

@@ -68,7 +68,7 @@ RUN fix-permissions /etc/jupyter/
# HEALTHCHECK documentation: https://docs.docker.com/engine/reference/builder/#healthcheck # HEALTHCHECK documentation: https://docs.docker.com/engine/reference/builder/#healthcheck
# This healtcheck works well for `lab`, `notebook`, `nbclassic`, `server`, and `retro` jupyter commands # This healtcheck works well for `lab`, `notebook`, `nbclassic`, `server`, and `retro` jupyter commands
# https://github.com/jupyter/docker-stacks/issues/915#issuecomment-1068528799 # https://github.com/jupyter/docker-stacks/issues/915#issuecomment-1068528799
HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=3 \ HEALTHCHECK --interval=3s --timeout=1s --start-period=3s --retries=3 \
CMD /etc/jupyter/docker_healthcheck.py || exit 1 CMD /etc/jupyter/docker_healthcheck.py || exit 1
# Switch back to jovyan to avoid accidental container runs as root # Switch back to jovyan to avoid accidental container runs as root

View File

@@ -67,13 +67,11 @@ def test_healthy(
user=user, user=user,
) )
# sleeping some time to let the server start # giving some time to let the server start
time_spent = 0.0 finish_time = time.time() + 10
wait_time = 0.1 sleep_time = 0.1
time_limit = 15 while time.time() < finish_time:
while time_spent < time_limit: time.sleep(sleep_time)
time.sleep(wait_time)
time_spent += wait_time
if get_health(running_container) == "healthy": if get_health(running_container) == "healthy":
return return
@@ -114,13 +112,11 @@ def test_healthy_with_proxy(
user=user, user=user,
) )
# sleeping some time to let the server start # giving some time to let the server start
time_spent = 0.0 finish_time = time.time() + 10
wait_time = 0.1 sleep_time = 0.1
time_limit = 15 while time.time() < finish_time:
while time_spent < time_limit: time.sleep(sleep_time)
time.sleep(wait_time)
time_spent += wait_time
if get_health(running_container) == "healthy": if get_health(running_container) == "healthy":
return return
@@ -152,13 +148,11 @@ def test_not_healthy(
command=cmd, command=cmd,
) )
# sleeping some time to let the server start # giving some time to let the server start
time_spent = 0.0 finish_time = time.time() + 5
wait_time = 0.1 sleep_time = 0.1
time_limit = 15 while time.time() < finish_time:
while time_spent < time_limit: time.sleep(sleep_time)
time.sleep(wait_time)
time_spent += wait_time
if get_health(running_container) == "healthy": if get_health(running_container) == "healthy":
raise RuntimeError("Container should not be healthy for this testcase") raise RuntimeError("Container should not be healthy for this testcase")

View File

@@ -24,7 +24,7 @@ def check_pluto_proxy(
ports={"8888/tcp": host_port}, ports={"8888/tcp": host_port},
) )
# Give the server a bit of time to start # Give the server a bit of time to start
time.sleep(3) time.sleep(2)
resp = http_client.get(f"http://localhost:{host_port}/pluto?token={token}") resp = http_client.get(f"http://localhost:{host_port}/pluto?token={token}")
resp.raise_for_status() resp.raise_for_status()
assert "Pluto.jl notebooks" in resp.text, "Pluto.jl text not found in /pluto page" assert "Pluto.jl notebooks" in resp.text, "Pluto.jl text not found in /pluto page"