From cddce661826f32a9a59fd1ec467f9cf9846ca72a Mon Sep 17 00:00:00 2001 From: Joel Klinger Date: Tue, 3 Jan 2023 08:32:05 +0000 Subject: [PATCH] [NRLF-120] Enable status endpoint (#16) Co-authored-by: Joel Klinger --- README.md | 6 ++++- ...ServiceCallout.CallHealthcheckEndpoint.xml | 27 +++++++++---------- tests/api_tests.py | 2 ++ 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 9212b06..3eefb68 100644 --- a/README.md +++ b/README.md @@ -187,6 +187,10 @@ Then export the following env var: If you want to run the smoke tests against a particular product or app then you can set up the command like this: -Example using `nrl-producer-api-pr-15` as the app: +Example using for the current product deployed to `internal-dev`: + +`pytest tests/api_tests.py::test_smoke --proxy-name="nrl-producer-api-internal-dev" --api-name=nrl-producer-api` + +Example using the product deployed for GitHub pull request 15: `pytest tests/api_tests.py::test_smoke --proxy-name="nrl-producer-api-pr-15" --api-name=nrl-producer-api` \ No newline at end of file diff --git a/proxies/live/apiproxy/policies/ServiceCallout.CallHealthcheckEndpoint.xml b/proxies/live/apiproxy/policies/ServiceCallout.CallHealthcheckEndpoint.xml index 201fc65..e7a61b4 100644 --- a/proxies/live/apiproxy/policies/ServiceCallout.CallHealthcheckEndpoint.xml +++ b/proxies/live/apiproxy/policies/ServiceCallout.CallHealthcheckEndpoint.xml @@ -3,25 +3,22 @@ ServiceCallout.CallHealthcheckEndpoint + + +
{request.header.NHSD-Correlation-ID}
+
+
false
healthcheckResponse - - - - - - - - - - http://mocktarget.apigee.net - - true - User-Agent,Referer,Accept-Language - apikey - + + true + + + + + /production/_status 20000 diff --git a/tests/api_tests.py b/tests/api_tests.py index d1c01c6..8bd9749 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -22,6 +22,8 @@ def test_status_endpoint(nhsd_apim_proxy_url, status_endpoint_auth_headers): status_json = resp.json() assert resp.status_code == 200 assert status_json["status"] == "pass" + assert status_json["checks"]['healthcheck']["responseCode"] == 200 + assert status_json["checks"]['healthcheck']["outcome"] == {"message": "OK"} @pytest.mark.nhsd_apim_authorization({"access": "application", "level": "level3"})