Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add health checks to deployment tests #1694

Merged
merged 1 commit into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("/")
20 changes: 19 additions & 1 deletion tests/test_http.py
Original file line number Diff line number Diff line change
@@ -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):
"""
Expand All @@ -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)
Expand Down