diff --git a/tests/conftest.py b/tests/conftest.py index dab63060c..a32189b6d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,10 +11,12 @@ def pytest_addoption(parser): help="Fully qualified URL to the hub installation" ) + @pytest.fixture def binder_url(request): - return request.config.getoption('--binder-url') + return request.config.getoption("--binder-url").rstrip("/") + @pytest.fixture def hub_url(request): - return request.config.getoption('--hub-url') + return request.config.getoption("--hub-url").rstrip("/") diff --git a/tests/test_http.py b/tests/test_http.py index 913e2faf4..e75c4dbdd 100644 --- a/tests/test_http.py +++ b/tests/test_http.py @@ -1,5 +1,9 @@ -import requests +"""Basic HTTP tests to make sure things are running""" +import pprint + import pytest +import requests + def test_binder_up(binder_url): """ @@ -20,6 +24,20 @@ def test_hub_up(hub_url): assert resp.status_code == 403 +def test_hub_health(hub_url): + """check JupyterHubHub health endpoint""" + resp = requests.get(hub_url + "/hub/health") + print(resp.text) + assert resp.status_code == 200 + + +def test_binder_health(binder_url): + """check BinderHub health endpoint""" + resp = requests.get(binder_url + "/health") + pprint.pprint(resp.json()) + assert resp.status_code == 200 + + # the proxy-patches pod can take up to 30 seconds # to register its route after a proxy restart @pytest.mark.flaky(reruns=3, reruns_delay=10)