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

Fix api healthchecks #87

Merged
merged 9 commits into from
Jun 19, 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
5 changes: 5 additions & 0 deletions .github/workflows/PR-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,11 @@ jobs:
tags: agr_pavi/webui:latest
outputs: type=docker,dest=/tmp/pavi_webui_docker_image.tar
commit-deps-lock-updates:
#TODO: Moving the commit from before to after merge to prevent need for repetitive forced reruns of PR-validation.
# * Convert this job into job that tars up all updated dependency files and uploads them as a single artifact.
# * The new artifact should then be downloaded, unpacked and committed in the main-build-and-deploy workflow.
# * PR validation should get an additional job that reports in the open PR if dependency files have been updated,
# with a link to the updated files or summary report to enable inspection before merge (download and report git diff?).
runs-on: ubuntu-22.04
#Only commit updated lock files on successfull validation (to prevent PR cluttering)
needs:
Expand Down
4 changes: 2 additions & 2 deletions api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ run-tests: test-deps nextflow.sh protein-msa.nf nextflow.config
python -m pytest --cov --cov-fail-under=80

run-tests-dev: test-deps nextflow.sh protein-msa.nf nextflow.config
python -m pytest --cov --cov-fail-under=80 --cov-report html
python -m pytest --cov --cov-fail-under=80 --cov-report html -v

run-integration-test-container: test-deps
export API_PIPELINE_IMAGE_TAG=${TAG_NAME} && \
docker-compose -f docker-compose-dev.yml --env-file dev.env up -d agr.pavi.dev-local.api
sleep 30 # Allow container some startup time before attempting to connect
export EXTERNAL_API_BASE_URL="http://localhost:8080" && \
python -m pytest tests/integration \
python -m pytest tests/b_integration \
|| (echo "Container logs:" && docker logs agr.pavi.dev-local.api.server && exit 1)
docker-compose -f docker-compose-dev.yml down
2 changes: 1 addition & 1 deletion api/aws_infra/.ebextensions/loadbalancer.yml.config
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ option_settings:
aws:elasticbeanstalk:environment:process:api:
Port: '8080'
Protocol: HTTP
HealthCheckPath: /api/health/
HealthCheckPath: /api/health
MatcherHTTPCode: 200
aws:elbv2:loadbalancer:
IdleTimeout: 600
File renamed without changes.
4 changes: 2 additions & 2 deletions api/tests/unit/test_main.py → api/tests/a_unit/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from main import app
from uuid import UUID

client = TestClient(app)
client = TestClient(app, follow_redirects=False)

NOT_FOUND_UUID: UUID = UUID('00000000-0000-0000-0000-000000000000')

Expand All @@ -12,7 +12,7 @@
# If path or response status-code changes then .ebextensions/loadbalancer.yml.config
# needs to be updated (HealthCheckPath)
def test_health_reporting() -> None:
response = client.get("/api/health/")
response = client.get("/api/health")

assert response.status_code == 200

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

client: TestClient | Client
if external_api_base_url:
client = Client(base_url=external_api_base_url)
client = Client(base_url=external_api_base_url, follow_redirects=False)
else:
client = TestClient(app)
client = TestClient(app, follow_redirects=False)
environ["API_RESULTS_PATH_PREFIX"] = f'{getcwd()}/'
environ["API_EXECUTION_ENV"] = 'local'

Expand Down
2 changes: 1 addition & 1 deletion pipeline/seq_retrieval/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ run-unit-tests: test-deps
python -m pytest --cov --cov-fail-under=80

run-unit-tests-dev: test-deps
python -m pytest --cov --cov-fail-under=80 --cov-report html
python -m pytest --cov --cov-fail-under=80 --cov-report html -v

run-code-checks: run-type-checks run-style-checks run-unit-tests

Expand Down