Skip to content
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
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ TEST_CMD := @APIGEE_ACCESS_TOKEN="$(APIGEE_ACCESS_TOKEN)" \
--proxy-name="$(PROXY_NAME)" \
-s \
--reruns 5 \
--reruns-delay 5 \
--reruns-delay 30 \
--only-rerun 'AssertionError: Unexpected 429' \
--only-rerun 'AssertionError: Unexpected 504' \
--only-rerun 'AssertionError: Unexpected 401' \
--only-rerun 'AssertionError: Unexpected 502' \
--only-rerun 'Datastore Error' \
--junitxml=test-report.xml

PERFTEST_CMD := @APIGEE_ACCESS_TOKEN="$(APIGEE_ACCESS_TOKEN)" \
Expand All @@ -127,9 +128,12 @@ PROD_TEST_CMD := @APIGEE_ACCESS_TOKEN="$(APIGEE_ACCESS_TOKEN)" \
--proxy-name="$(PROXY_NAME)" \
-s \
--reruns 5 \
--reruns-delay 5 \
--reruns-delay 30 \
--only-rerun 'AssertionError: Unexpected 429' \
--only-rerun 'AssertionError: Unexpected 504' \
--only-rerun 'AssertionError: Unexpected 401' \
--only-rerun 'AssertionError: Unexpected 502' \
--only-rerun 'Datastore Error' \
--apigee-app-id="$(APIGEE_APP_ID)" \
--apigee-organization=nhsd-prod \
--status-endpoint-api-key="$(STATUS_ENDPOINT_API_KEY)" \
Expand Down
18 changes: 15 additions & 3 deletions postman/NhsNotify.Integration.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,21 @@
"listen" : "test",
"script" : {
"exec" : [
"pm.test(\"Status code is 200\", () => {",
" pm.response.to.have.status(200);",
"});"
"const maxRetries = 5;",
"const retryKey = \"nhs_app_account_retry_count\";",
"const retries = Number(pm.environment.get(retryKey) || 0);",
"",
"// setNextRequest only takes effect in the collection runner / Newman",
"if (pm.response.code !== 200 && retries < maxRetries) {",
" pm.environment.set(retryKey, retries + 1);",
" console.log(`Status ${pm.response.code}, retrying (${retries + 1}/${maxRetries})`);",
" pm.execution.setNextRequest(pm.info.requestName);",
"} else {",
" pm.environment.unset(retryKey);",
" pm.test(\"Status code is 200\", () => {",
" pm.response.to.have.status(200);",
" });",
"}"
],
"id" : "cd9304fc-d712-4e40-8e59-8564be7c4bed",
"packages" : {},
Expand Down
1 change: 1 addition & 0 deletions tests/api/nhsapp_accounts/test_200_success.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@pytest.mark.devtest
@pytest.mark.inttest
@pytest.mark.prodtest
@pytest.mark.flaky(reruns=5)
@pytest.mark.parametrize("ods_code", LIVE_ODS_CODES)
@pytest.mark.parametrize("page", VALID_SINGLE_PAGE_NUMBERS)
def test_single_page(url, bearer_token, ods_code, page):
Expand Down
13 changes: 12 additions & 1 deletion tests/lib/constants/constants.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
import os

import pytest

INT_URL = "https://int.api.service.nhs.uk/comms"
PROD_URL = "https://api.service.nhs.uk/comms"
VALID_ENDPOINTS = [
"/v1/message-batches",
"/v1/messages",
"/v1/api/send",
"/v1/messages/1234",
"/v1/message-responses/11111111-1111-4111-8111-111111111111",
# ref has no app-response backend; the endpoint is deliberately disabled there
pytest.param(
"/v1/message-responses/11111111-1111-4111-8111-111111111111",
marks=pytest.mark.skipif(
os.environ.get("API_ENVIRONMENT") == "ref",
reason="message-responses endpoint is not available in ref"
),
),
]
CORS_METHODS = "GET, PUT, POST, PATCH, DELETE"
CORS_MAX_AGE = "3628800"
Expand Down
Loading