Skip to content

Commit

Permalink
Adjust sleep times (#2080)
Browse files Browse the repository at this point in the history
* Adjust sleep times

* Update test_start_container.py

* Update test_healthcheck.py

* Update pluto_check.py
  • Loading branch information
mathbunnyru authored Jan 16, 2024
1 parent 86dc0f2 commit d57bf95
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion images/base-notebook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ RUN fix-permissions /etc/jupyter/
# HEALTHCHECK documentation: https://docs.docker.com/engine/reference/builder/#healthcheck
# This healtcheck works well for `lab`, `notebook`, `nbclassic`, `server`, and `retro` jupyter commands
# 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

# Switch back to jovyan to avoid accidental container runs as root
Expand Down
36 changes: 15 additions & 21 deletions tests/base-notebook/test_healthcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ def test_healthy(
user=user,
)

# sleeping some time to let the server start
time_spent = 0.0
wait_time = 0.1
time_limit = 15
while time_spent < time_limit:
time.sleep(wait_time)
time_spent += wait_time
# giving some time to let the server start
finish_time = time.time() + 10
sleep_time = 0.1
while time.time() < finish_time:
time.sleep(sleep_time)
if get_health(running_container) == "healthy":
return

Expand Down Expand Up @@ -114,13 +112,11 @@ def test_healthy_with_proxy(
user=user,
)

# sleeping some time to let the server start
time_spent = 0.0
wait_time = 0.1
time_limit = 15
while time_spent < time_limit:
time.sleep(wait_time)
time_spent += wait_time
# giving some time to let the server start
finish_time = time.time() + 10
sleep_time = 0.1
while time.time() < finish_time:
time.sleep(sleep_time)
if get_health(running_container) == "healthy":
return

Expand Down Expand Up @@ -152,13 +148,11 @@ def test_not_healthy(
command=cmd,
)

# sleeping some time to let the server start
time_spent = 0.0
wait_time = 0.1
time_limit = 15
while time_spent < time_limit:
time.sleep(wait_time)
time_spent += wait_time
# giving some time to let the server start
finish_time = time.time() + 5
sleep_time = 0.1
while time.time() < finish_time:
time.sleep(sleep_time)
if get_health(running_container) == "healthy":
raise RuntimeError("Container should not be healthy for this testcase")

Expand Down
2 changes: 1 addition & 1 deletion tests/pluto_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def check_pluto_proxy(
ports={"8888/tcp": host_port},
)
# 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.raise_for_status()
assert "Pluto.jl notebooks" in resp.text, "Pluto.jl text not found in /pluto page"

0 comments on commit d57bf95

Please sign in to comment.