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

Print container logs if service fails to start #782

Merged
merged 1 commit into from
Jul 23, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-test-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
run: echo "JUPYTER_TOKEN=$(openssl rand -hex 32)" >> $GITHUB_ENV

- name: Run pytest for Chrome
run: pytest --driver Chrome tests_integration/
run: pytest -sv --driver Chrome tests_integration/
env:
QE_IMAGE: ${{ env.IMAGE }}@${{ steps.build-upload.outputs.digest }}

Expand Down
17 changes: 10 additions & 7 deletions tests_integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,22 @@ def nb_user(aiidalab_exec):


@pytest.fixture(scope="session")
def notebook_service(docker_ip, docker_services):
def notebook_service(docker_compose, docker_ip, docker_services):
"""Ensure that HTTP service is up and responsive."""

# `port_for` takes a container port and returns the corresponding host port
port = docker_services.port_for("aiidalab", 8888)
url = f"http://{docker_ip}:{port}"
token = os.environ.get("JUPYTER_TOKEN", "testtoken")
docker_services.wait_until_responsive(
# The timeout is very high for this test, because the installation of pseudo libraries.
timeout=180.0,
pause=0.1,
check=lambda: is_responsive(url),
)
try:
docker_services.wait_until_responsive(
timeout=180.0,
pause=1.0,
check=lambda: is_responsive(url),
)
except Exception as e:
print(docker_compose.execute("logs").decode().strip())
pytest.exit(e)
return url, token


Expand Down
Loading