From f808da2e0d2f4b9186539ed56a334d915778e6ab Mon Sep 17 00:00:00 2001 From: Tom Young <39765193+t-young31@users.noreply.github.com> Date: Thu, 12 Oct 2023 11:32:46 +0100 Subject: [PATCH] Fix CI (#147) * fix ci * fix cwd --- docker-compose.yml | 21 ++++++--------------- hasher/src/requirements.txt | 12 ++++++------ patient_queue/src/requirements.txt | 2 +- pixl_ehr/src/pixl_ehr/main.py | 4 +++- pixl_ehr/src/pixl_ehr/tests/test_app.py | 9 ++------- pixl_ehr/src/requirements.txt | 18 +++++++++--------- pixl_pacs/src/pixl_pacs/main.py | 3 ++- pixl_rd/src/requirements.txt | 4 ++-- test/docker-compose.yml | 3 ++- token_buffer/src/requirements.txt | 4 ++-- 10 files changed, 35 insertions(+), 45 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a14dd78c0..cd42d1e70 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,7 +28,7 @@ x-proxy-common: &proxy-common no_proxy: *no-proxy x-build-args-common: &build-args-common - <<: *proxy-common + <<: [*proxy-common] x-pixl-common-env: &pixl-common-env ENV: ${ENV} @@ -80,8 +80,7 @@ services: args: <<: *build-args-common environment: - <<: *proxy-common - <<: *pixl-common-env + <<: [*proxy-common, *pixl-common-env] AZURE_CLIENT_ID: ${HASHER_API_AZ_CLIENT_ID} AZURE_CLIENT_SECRET: ${HASHER_API_AZ_CLIENT_PASSWORD} AZURE_TENANT_ID: ${HASHER_API_AZ_TENANT_ID} @@ -110,6 +109,7 @@ services: <<: *build-args-common command: /run/secrets environment: + <<: [*proxy-common, *pixl-common-env] ORTHANC_NAME: "PIXL: Anon" ORTHANC_USERNAME: ${ORTHANC_ANON_USERNAME} ORTHANC_PASSWORD: ${ORTHANC_ANON_PASSWORD} @@ -131,8 +131,6 @@ services: AZ_DICOM_TOKEN_REFRESH_SECS: "600" TIME_OFFSET: "${STUDY_TIME_OFFSET}" SALT_VALUE: ${SALT_VALUE}" - <<: *proxy-common - <<: *pixl-common-env ports: - "${ORTHANC_ANON_DICOM_PORT}:4242" - "${ORTHANC_ANON_WEB_PORT}:8042" @@ -161,6 +159,7 @@ services: <<: *build-args-common command: /run/secrets environment: + <<: [*pixl-db, *proxy-common, *pixl-common-env] ORTHANC_NAME: "PIXL: Raw" ORTHANC_USERNAME: ${ORTHANC_RAW_USERNAME} ORTHANC_PASSWORD: ${ORTHANC_RAW_PASSWORD} @@ -175,9 +174,6 @@ services: ORTHANC_ANON_AE_TITLE: ${ORTHANC_ANON_AE_TITLE} ORTHANC_ANON_DICOM_PORT: "4242" ORTHANC_ANON_HOSTNAME: "orthanc-anon" - <<: *pixl-db - <<: *proxy-common - <<: *pixl-common-env ports: - "${ORTHANC_RAW_DICOM_PORT}:4242" - "${ORTHANC_RAW_WEB_PORT}:8042" @@ -227,11 +223,7 @@ services: args: <<: *build-args-common environment: - <<: *pixl-db - <<: *emap-db - <<: *proxy-common - <<: *pixl-common-env - <<: *pixl-rabbit-mq + <<: [*pixl-db, *emap-db, *proxy-common, *pixl-common-env, *pixl-rabbit-mq] AZURE_CLIENT_ID: ${PIXL_EHR_API_AZ_CLIENT_ID} AZURE_CLIENT_SECRET: ${PIXL_EHR_API_AZ_CLIENT_SECRET} AZURE_TENANT_ID: ${PIXL_EHR_API_AZ_TENANT_ID} @@ -273,8 +265,7 @@ services: networks: - pixl-net environment: - <<: *pixl-rabbit-mq - <<: *proxy-common + <<: [*pixl-rabbit-mq, *proxy-common] ORTHANC_RAW_USERNAME: ${ORTHANC_RAW_USERNAME} ORTHANC_RAW_PASSWORD: ${ORTHANC_RAW_PASSWORD} ORTHANC_RAW_AE_TITLE: ${ORTHANC_RAW_AE_TITLE} diff --git a/hasher/src/requirements.txt b/hasher/src/requirements.txt index e9f0a06a9..c16aeef74 100644 --- a/hasher/src/requirements.txt +++ b/hasher/src/requirements.txt @@ -1,15 +1,15 @@ azure-identity==1.12.0 azure-keyvault==4.2.0 black==22.8.0 -fastapi==0.85.2 +fastapi==0.103.2 flake8==5.0.4 flake8-return==1.1.3 hypothesis==6.56.0 isort==5.10.1 environs==9.5.0 -ipython==8.5.0 -mypy==0.991 -pytest==7.1.3 +mypy==1.6.0 +httpx==0.25.0 +pytest==7.4.2 pytest-mock==3.8.2 -requests==2.28.1 -uvicorn==0.19.0 \ No newline at end of file +requests==2.31.0 +uvicorn==0.23.2 diff --git a/patient_queue/src/requirements.txt b/patient_queue/src/requirements.txt index 1a4bb76bf..d754d77f2 100644 --- a/patient_queue/src/requirements.txt +++ b/patient_queue/src/requirements.txt @@ -5,7 +5,7 @@ flake8==5.0.4 flake8-return==1.1.3 isort==5.10.1 environs==9.5.0 -mypy==0.991 +mypy==1.6.0 pytest==7.1.3 pytest-asyncio==0.20.2 python-decouple==3.6 \ No newline at end of file diff --git a/pixl_ehr/src/pixl_ehr/main.py b/pixl_ehr/src/pixl_ehr/main.py index c5a636c6b..a9fdf7c98 100644 --- a/pixl_ehr/src/pixl_ehr/main.py +++ b/pixl_ehr/src/pixl_ehr/main.py @@ -80,7 +80,9 @@ async def update_tb_refresh_rate(item: TokenRefreshUpdate) -> str: @app.get( - "/token-bucket-refresh-rate", summary="Get the refresh rate in items per second" + "/token-bucket-refresh-rate", + summary="Get the refresh rate in items per second", + response_model=TokenRefreshUpdate, ) async def get_tb_refresh_rate() -> BaseModel: return TokenRefreshUpdate(rate=state.token_bucket.rate) diff --git a/pixl_ehr/src/pixl_ehr/tests/test_app.py b/pixl_ehr/src/pixl_ehr/tests/test_app.py index 2aa4c17ec..8f82f7ab4 100644 --- a/pixl_ehr/src/pixl_ehr/tests/test_app.py +++ b/pixl_ehr/src/pixl_ehr/tests/test_app.py @@ -16,15 +16,10 @@ """ from fastapi.testclient import TestClient from pixl_ehr.main import AppState, app, state -from requests import Response client = TestClient(app) -def _is_error(response: Response) -> bool: - return bool(400 <= int(response.status_code) < 450) - - def test_heartbeat_response_is_200() -> None: response = client.get("/heart-beat") assert response.status_code == 200 @@ -37,13 +32,13 @@ def test_initial_state_has_no_token() -> None: def test_updating_the_token_refresh_rate_to_negative_fails() -> None: response = client.post("/token-bucket-refresh-rate", json={"rate": -1}) - assert _is_error(response) + assert response.is_error def test_updating_the_token_refresh_rate_to_string_fails() -> None: response = client.post("/token-bucket-refresh-rate", json={"rate": "a string"}) - assert _is_error(response) + assert response.is_error def test_updating_the_token_refresh_rate_updates_state() -> None: diff --git a/pixl_ehr/src/requirements.txt b/pixl_ehr/src/requirements.txt index 26421e5b9..25cb515e7 100644 --- a/pixl_ehr/src/requirements.txt +++ b/pixl_ehr/src/requirements.txt @@ -1,17 +1,17 @@ black==22.8.0 +fastapi==0.103.2 flake8==5.0.4 flake8-return==1.1.3 +hypothesis==6.56.0 isort==5.10.1 environs==9.5.0 -mypy==0.991 -pytest==7.1.3 -click==8.1.3 -coloredlogs==15.0.1 -fastapi==0.85.2 -pydantic==1.9.2 -uvicorn==0.19.0 -requests==2.28.1 -types-requests==2.28.* +mypy==1.6.0 +httpx==0.25.0 +pytest==7.4.2 +requests==2.31.0 +uvicorn==0.23.2 +pydantic==1.10.13 +types-requests==2.31.0 psycopg2-binary==2.9.5 azure-identity==1.12.0 azure-storage-blob==12.14.1 diff --git a/pixl_pacs/src/pixl_pacs/main.py b/pixl_pacs/src/pixl_pacs/main.py index 780a58f98..2faa89e25 100644 --- a/pixl_pacs/src/pixl_pacs/main.py +++ b/pixl_pacs/src/pixl_pacs/main.py @@ -76,7 +76,8 @@ async def update_tb_refresh_rate(item: TokenRefreshUpdate) -> str: @app.get( - "/token-bucket-refresh-rate", summary="Get the refresh rate in items per second" + "/token-bucket-refresh-rate", summary="Get the refresh rate in items per second", + response_model=TokenRefreshUpdate, ) async def get_tb_refresh_rate() -> BaseModel: return TokenRefreshUpdate(rate=state.token_bucket.rate) diff --git a/pixl_rd/src/requirements.txt b/pixl_rd/src/requirements.txt index 956b4c0be..746869322 100644 --- a/pixl_rd/src/requirements.txt +++ b/pixl_rd/src/requirements.txt @@ -3,8 +3,8 @@ flake8==5.0.4 flake8-return==1.1.3 isort==5.10.1 environs==9.5.0 -mypy==0.991 -pytest==7.1.3 +mypy==1.6.0 +pytest==7.4.2 presidio-analyzer==2.2.29 presidio-anonymizer==2.2.29 python-decouple==3.6 diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 8fc8567bb..cdec7662d 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -64,7 +64,8 @@ services: context: .. dockerfile: test/Dockerfile.fake_emap_star args: - N_TABLE_ROWS: 1 + N_TABLE_ROWS: 2 + INFORMDB_PAT: ${INFORMDB_PAT} environment: POSTGRES_USER: ${EMAP_UDS_USER} POSTGRES_PASSWORD: ${EMAP_UDS_PASSWORD} diff --git a/token_buffer/src/requirements.txt b/token_buffer/src/requirements.txt index d20199e6e..570843307 100644 --- a/token_buffer/src/requirements.txt +++ b/token_buffer/src/requirements.txt @@ -2,7 +2,7 @@ black==22.8.0 flake8==5.0.4 flake8-return==1.1.3 isort==5.10.1 -mypy==0.991 -pytest==7.1.3 +mypy==1.6.0 +pytest==7.4.2 token-bucket==0.3.0 python-decouple==3.6