From 467a8fc7de8134ba8cd761281169be2d67b5419c Mon Sep 17 00:00:00 2001 From: Feyisayo Afolabi Date: Wed, 8 Apr 2026 09:51:49 +0100 Subject: [PATCH 01/12] CHORE: [ELI-751] Initial commit for workflow. --- .../workflows/error_handling_utils_tests.yml | 24 ++++++++++++++++ .github/workflows/pull_request.yml | 28 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/error_handling_utils_tests.yml diff --git a/.github/workflows/error_handling_utils_tests.yml b/.github/workflows/error_handling_utils_tests.yml new file mode 100644 index 00000000..51b93ef5 --- /dev/null +++ b/.github/workflows/error_handling_utils_tests.yml @@ -0,0 +1,24 @@ +name: Error Handling Utils Tests + +on: + workflow_call: + +jobs: + error_handling_utils_tests: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest pyyaml requests boto3 flask jinja2 lxml werkzeug six + + - name: Run error handling utils tests + run: pytest tests/test_error_handling_utils.py diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index bd7ef6ea..c12ade28 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -36,3 +36,31 @@ jobs: id: "Run during opened pull request" github_tag: ${{ github.event.pull_request.head.ref }} secrets: inherit + + error_handling_utils_changes: + if: >- + (github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]') || + (github.event_name == 'pull_request_target' && github.event.pull_request.user.login == 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository) + runs-on: ubuntu-latest + outputs: + should_run: ${{ steps.filter.outputs.error_handling_utils }} + steps: + - name: Detect relevant changes + id: filter + uses: dorny/paths-filter@v3 + with: + filters: | + error_handling_utils: + - 'tests/test_error_handling_utils.py' + - 'utils/data_helper.py' + - 'utils/dynamo_helper.py' + - 'utils/eligibility_api_client.py' + - 'tests/performance_tests/validate_inputs.py' + + error_handling_utils_tests: + if: >- + needs.error_handling_utils_changes.outputs.should_run == 'true' && + ((github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]') || + (github.event_name == 'pull_request_target' && github.event.pull_request.user.login == 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)) + needs: error_handling_utils_changes + uses: ./.github/workflows/error_handling_utils_tests.yml From d9c5bf92fa8f0d6073aaaef1dad30cc0856d6b26 Mon Sep 17 00:00:00 2001 From: Feyisayo Afolabi Date: Wed, 8 Apr 2026 12:14:08 +0100 Subject: [PATCH 02/12] Chore: [ELI-751] - Initial commit for workflow. --- tests/performance_tests/validate_inputs.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/performance_tests/validate_inputs.py b/tests/performance_tests/validate_inputs.py index 4cc6e29d..a3bd0aee 100644 --- a/tests/performance_tests/validate_inputs.py +++ b/tests/performance_tests/validate_inputs.py @@ -55,10 +55,7 @@ def main() -> None: run_time_seconds = parse_run_time_to_seconds(run_time) if run_time_seconds > MAX_RUN_TIME_SECONDS: - fail( - "Run time too long", - f"run_time must be 30m or less. Got: {run_time}", - ) + fail("Run time too long", f"run_time must be 30m or less. Got: {run_time}") print("Performance test inputs validated successfully.") From 494425e8a1c8dfea2caabc78feeba452f2935ec7 Mon Sep 17 00:00:00 2001 From: Feyisayo Afolabi Date: Wed, 8 Apr 2026 12:26:38 +0100 Subject: [PATCH 03/12] Chore: [ELI-751] - fixed failing error_handling_utils_tests. --- .github/workflows/error_handling_utils_tests.yml | 2 +- tests/performance_tests/validate_inputs.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/error_handling_utils_tests.yml b/.github/workflows/error_handling_utils_tests.yml index 51b93ef5..f69e0157 100644 --- a/.github/workflows/error_handling_utils_tests.yml +++ b/.github/workflows/error_handling_utils_tests.yml @@ -18,7 +18,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest pyyaml requests boto3 flask jinja2 lxml werkzeug six + pip install pytest pyyaml requests boto3 flask jinja2 lxml werkzeug six python-dotenv - name: Run error handling utils tests run: pytest tests/test_error_handling_utils.py diff --git a/tests/performance_tests/validate_inputs.py b/tests/performance_tests/validate_inputs.py index a3bd0aee..4cc6e29d 100644 --- a/tests/performance_tests/validate_inputs.py +++ b/tests/performance_tests/validate_inputs.py @@ -55,7 +55,10 @@ def main() -> None: run_time_seconds = parse_run_time_to_seconds(run_time) if run_time_seconds > MAX_RUN_TIME_SECONDS: - fail("Run time too long", f"run_time must be 30m or less. Got: {run_time}") + fail( + "Run time too long", + f"run_time must be 30m or less. Got: {run_time}", + ) print("Performance test inputs validated successfully.") From 134f7725d98bf314dd25479a3f79279b20e94ab3 Mon Sep 17 00:00:00 2001 From: Feyisayo Afolabi Date: Wed, 8 Apr 2026 12:34:09 +0100 Subject: [PATCH 04/12] Chore: [ELI-751] - fixed failing error_handling_utils_tests. --- tests/performance_tests/validate_inputs.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/performance_tests/validate_inputs.py b/tests/performance_tests/validate_inputs.py index 4cc6e29d..a3bd0aee 100644 --- a/tests/performance_tests/validate_inputs.py +++ b/tests/performance_tests/validate_inputs.py @@ -55,10 +55,7 @@ def main() -> None: run_time_seconds = parse_run_time_to_seconds(run_time) if run_time_seconds > MAX_RUN_TIME_SECONDS: - fail( - "Run time too long", - f"run_time must be 30m or less. Got: {run_time}", - ) + fail("Run time too long", f"run_time must be 30m or less. Got: {run_time}") print("Performance test inputs validated successfully.") From 5ae29be7f7e36d7377573f209e393745d1702127 Mon Sep 17 00:00:00 2001 From: Feyisayo Afolabi Date: Wed, 8 Apr 2026 12:42:34 +0100 Subject: [PATCH 05/12] Chore: [ELI-751] - fixed failing error_handling_utils_tests. --- .github/workflows/error_handling_utils_tests.yml | 8 +++++++- tests/performance_tests/validate_inputs.py | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/error_handling_utils_tests.yml b/.github/workflows/error_handling_utils_tests.yml index f69e0157..3cc687b8 100644 --- a/.github/workflows/error_handling_utils_tests.yml +++ b/.github/workflows/error_handling_utils_tests.yml @@ -2,6 +2,12 @@ name: Error Handling Utils Tests on: workflow_call: + inputs: + environment: + description: "Environment to run tests against" + type: string + required: false + default: "dev" jobs: error_handling_utils_tests: @@ -21,4 +27,4 @@ jobs: pip install pytest pyyaml requests boto3 flask jinja2 lxml werkzeug six python-dotenv - name: Run error handling utils tests - run: pytest tests/test_error_handling_utils.py + run: pytest --env=${{ inputs.environment }} tests/test_error_handling_utils.py diff --git a/tests/performance_tests/validate_inputs.py b/tests/performance_tests/validate_inputs.py index a3bd0aee..4cc6e29d 100644 --- a/tests/performance_tests/validate_inputs.py +++ b/tests/performance_tests/validate_inputs.py @@ -55,7 +55,10 @@ def main() -> None: run_time_seconds = parse_run_time_to_seconds(run_time) if run_time_seconds > MAX_RUN_TIME_SECONDS: - fail("Run time too long", f"run_time must be 30m or less. Got: {run_time}") + fail( + "Run time too long", + f"run_time must be 30m or less. Got: {run_time}", + ) print("Performance test inputs validated successfully.") From 45edbe06a9d28c496103611291ef3b3aa135cc98 Mon Sep 17 00:00:00 2001 From: Feyisayo Afolabi Date: Wed, 8 Apr 2026 12:52:19 +0100 Subject: [PATCH 06/12] Chore: [ELI-751] - fixed failing error_handling_utils_tests. --- tests/performance_tests/validate_inputs.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/performance_tests/validate_inputs.py b/tests/performance_tests/validate_inputs.py index 4cc6e29d..a3bd0aee 100644 --- a/tests/performance_tests/validate_inputs.py +++ b/tests/performance_tests/validate_inputs.py @@ -55,10 +55,7 @@ def main() -> None: run_time_seconds = parse_run_time_to_seconds(run_time) if run_time_seconds > MAX_RUN_TIME_SECONDS: - fail( - "Run time too long", - f"run_time must be 30m or less. Got: {run_time}", - ) + fail("Run time too long", f"run_time must be 30m or less. Got: {run_time}") print("Performance test inputs validated successfully.") From bffb4934dcacc5d404cc1f304d8068dad372939a Mon Sep 17 00:00:00 2001 From: Feyisayo Afolabi Date: Wed, 8 Apr 2026 13:09:43 +0100 Subject: [PATCH 07/12] Chore: [ELI-751] - fixed failing error_handling_utils_tests. --- .github/workflows/error_handling_utils_tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/error_handling_utils_tests.yml b/.github/workflows/error_handling_utils_tests.yml index 3cc687b8..aca526cc 100644 --- a/.github/workflows/error_handling_utils_tests.yml +++ b/.github/workflows/error_handling_utils_tests.yml @@ -27,4 +27,6 @@ jobs: pip install pytest pyyaml requests boto3 flask jinja2 lxml werkzeug six python-dotenv - name: Run error handling utils tests + env: + UNIT_TEST_ONLY: "true" run: pytest --env=${{ inputs.environment }} tests/test_error_handling_utils.py From ee255d1a152eed65d5d01a07d6f547081bd3dfe2 Mon Sep 17 00:00:00 2001 From: Feyisayo Afolabi Date: Wed, 8 Apr 2026 13:25:28 +0100 Subject: [PATCH 08/12] Chore: [ELI-751] - fixed failing error_handling_utils_tests. --- tests/conftest.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index e9963f2a..d0d9f7ab 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -83,6 +83,9 @@ def eligibility_client(): @pytest.fixture(scope="session", autouse=True) def upload_consumer_mapping_once(): + if os.getenv("UNIT_TEST_ONLY", "").lower() == "true": + logger.info("Skipping consumer mapping upload for unit-test-only run") + return upload_consumer_mapping_file_to_s3(test_config.CONSUMER_MAPPING_FILE) From f9ae6e3d71ed12a17a1580c74555cca7ca575fb6 Mon Sep 17 00:00:00 2001 From: Feyisayo Afolabi Date: Wed, 8 Apr 2026 13:40:41 +0100 Subject: [PATCH 09/12] Chore: [ELI-751] - fixed failing error_handling_utils_tests. --- tests/performance_tests/validate_inputs.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/performance_tests/validate_inputs.py b/tests/performance_tests/validate_inputs.py index a3bd0aee..e9b334bb 100644 --- a/tests/performance_tests/validate_inputs.py +++ b/tests/performance_tests/validate_inputs.py @@ -46,8 +46,13 @@ def parse_run_time_to_seconds(run_time: str) -> int: def main() -> None: - users = int(get_env("USERS")) - spawn_rate = int(get_env("SPAWN_RATE")) + try: + users = int(get_env("USERS")) + spawn_rate = int(get_env("SPAWN_RATE")) + except ValueError: + fail("Invalid input", "USERS must be an integer.") + return + run_time = get_env("RUN_TIME") validate_range("users", users, 1, MAX_USERS) From 83c6c0c1233c7228407424fe7a1a6af7965e8c2f Mon Sep 17 00:00:00 2001 From: Feyisayo Afolabi Date: Wed, 8 Apr 2026 14:01:38 +0100 Subject: [PATCH 10/12] Chore: [ELI-751] - fixed failing error_handling_utils_tests. --- tests/performance_tests/validate_inputs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/performance_tests/validate_inputs.py b/tests/performance_tests/validate_inputs.py index e9b334bb..e0b289bd 100644 --- a/tests/performance_tests/validate_inputs.py +++ b/tests/performance_tests/validate_inputs.py @@ -60,7 +60,10 @@ def main() -> None: run_time_seconds = parse_run_time_to_seconds(run_time) if run_time_seconds > MAX_RUN_TIME_SECONDS: - fail("Run time too long", f"run_time must be 30m or less. Got: {run_time}") + fail( + "Run time too long", + f"run_time must be 30m or less. Got: {run_time}", + ) print("Performance test inputs validated successfully.") From a75840c56db3073a29d17f27467ae25f1aaa0c14 Mon Sep 17 00:00:00 2001 From: Feyisayo Afolabi Date: Thu, 9 Apr 2026 10:32:02 +0100 Subject: [PATCH 11/12] Chore: [ELI-751] - fixed failing sonarcloud scan. --- .github/workflows/error_handling_utils_tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/error_handling_utils_tests.yml b/.github/workflows/error_handling_utils_tests.yml index aca526cc..fe6297ed 100644 --- a/.github/workflows/error_handling_utils_tests.yml +++ b/.github/workflows/error_handling_utils_tests.yml @@ -29,4 +29,5 @@ jobs: - name: Run error handling utils tests env: UNIT_TEST_ONLY: "true" - run: pytest --env=${{ inputs.environment }} tests/test_error_handling_utils.py + ENVIRONMENT: ${{ inputs.environment }} + run: pytest --env="$ENVIRONMENT" tests/test_error_handling_utils.py From 47a67c48430607cc37cdfb898fb5363e4d8bd662 Mon Sep 17 00:00:00 2001 From: Feyisayo Afolabi Date: Thu, 9 Apr 2026 11:00:13 +0100 Subject: [PATCH 12/12] Chore: [ELI-751] - fixed failing sonarcloud scan. --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c12ade28..764d51a8 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -47,7 +47,7 @@ jobs: steps: - name: Detect relevant changes id: filter - uses: dorny/paths-filter@v3 + uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 with: filters: | error_handling_utils: