diff --git a/.ds.baseline b/.ds.baseline index dde326a7c..485ff9443 100644 --- a/.ds.baseline +++ b/.ds.baseline @@ -629,10 +629,10 @@ "filename": "tests/conftest.py", "hashed_secret": "f8377c90fcfd699f0ddbdcb30c2c9183d2d933ea", "is_verified": false, - "line_number": 3267, + "line_number": 3279, "is_secret": false } ] }, - "generated_at": "2025-07-31T21:07:14Z" + "generated_at": "2025-08-07T18:05:06Z" } diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index b4ece1215..3d13cf505 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -101,7 +101,8 @@ jobs: # above make e2e-test run: | - make run-flask-and-wait > admin-server.log 2>&1 & + make run-flask > admin-server.log 2>&1 & + make wait-for-flask tail -f admin-server.log & make e2e-test diff --git a/Makefile b/Makefile index 7d52529ea..9de9b6492 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,12 @@ watch-frontend: ## Build frontend and watch for changes run-flask: ## Run flask poetry run newrelic-admin run-program flask run -p 6012 --host=0.0.0.0 +.PHONY: wait-for-flask +wait-for-flask: + @echo "Waiting for Flask to start..." + @timeout 30 bash -c 'until curl -sf http://localhost:6012 > /dev/null 2>&1; do sleep 1; done' + @echo "Flask is ready!" + .PHONY: run-flask-and-wait run-flask-and-wait: @make run-flask & diff --git a/tests/conftest.py b/tests/conftest.py index cba945a42..2174cc4b7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -556,6 +556,18 @@ def mock_update_service_raise_httperror_duplicate_name(mocker): return mocker.patch("app.service_api_client.update_service", side_effect=_update) +@pytest.fixture(autouse=True) +def _disable_e2e_mode_for_unit_tests(monkeypatch, request): + """ + Disable E2E test mode for all unit tests to prevent unmocked API calls. + E2E tests are run in a separate job and should not interfere with unit tests. + """ + # Only disable if unit tests are not being run + if "end_to_end" not in request.node.nodeid: + monkeypatch.delenv("NOTIFY_E2E_TEST_EMAIL", raising=False) + monkeypatch.delenv("NOTIFY_E2E_TEST_PASSWORD", raising=False) + + SERVICE_ONE_ID = "596364a0-858e-42c8-9062-a8fe822260eb" SERVICE_TWO_ID = "147ad62a-2951-4fa1-9ca0-093cd1a52c52" ORGANISATION_ID = "c011fa40-4cbe-4524-b415-dde2f421bd9c"