From 84109eec33babbf8e75fca65b2cef4fcc1af5ac8 Mon Sep 17 00:00:00 2001 From: Alex Carrie Date: Fri, 15 Jan 2021 09:36:43 +0000 Subject: [PATCH 1/2] APM-1710 Use allow_retries functionality on smoketests --- azure/azure-pr-pipeline.yml | 2 +- e2e/pyproject.toml | 2 +- e2e/tests/api_tests.py | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/azure/azure-pr-pipeline.yml b/azure/azure-pr-pipeline.yml index 14abcc6..8e4dd73 100644 --- a/azure/azure-pr-pipeline.yml +++ b/azure/azure-pr-pipeline.yml @@ -40,4 +40,4 @@ extends: post_deploy: - template: templates/e2e.yml parameters: - test_type: e2e \ No newline at end of file + test_type: smoketest # Change back to e2e after pr deloy test \ No newline at end of file diff --git a/e2e/pyproject.toml b/e2e/pyproject.toml index 0ba9f5e..a5da25f 100644 --- a/e2e/pyproject.toml +++ b/e2e/pyproject.toml @@ -13,7 +13,7 @@ pytest-asyncio = "^0.14.0" coverage = "^5.3" [tool.poetry.dev-dependencies] -api-test-utils = {url = "https://github.com/NHSDigital/apim-test-utils/releases/download/v1.0.14-alpha/api_test_utils-1.0.14a0-py3-none-any.whl"} +api-test-utils = {url = "https://github.com/NHSDigital/apim-test-utils/releases/download/v1.0.41-alpha/api_test_utils-1.0.41a0-py3-none-any.whl"} [build-system] requires = ["poetry>=0.12"] diff --git a/e2e/tests/api_tests.py b/e2e/tests/api_tests.py index 216ec9b..d65956a 100644 --- a/e2e/tests/api_tests.py +++ b/e2e/tests/api_tests.py @@ -49,22 +49,22 @@ async def _is_complete(resp: ClientResponse): @pytest.mark.asyncio async def test_api_status_with_service_header_another_service(api_client: APISessionClient): - async with api_client.get("_status", headers={'x-apim-service': 'async-slowapp'}) as r: - assert r.status == 200, (r.status, r.reason, (await r.text())[:2000]) - body = await r.json() + r = await api_client.get("_status", allow_retries=True, max_retries=5, headers={'x-apim-service': 'async-slowapp'}) + assert r.status == 200, (r.status, r.reason, (await r.text())[:2000]) + body = await r.json() - assert body.get('service') == 'sync-wrap' + assert body.get('service') == 'sync-wrap' @pytest.mark.smoketest @pytest.mark.asyncio async def test_api_status_with_service_header(api_client: APISessionClient): - async with api_client.get("_status", headers={'x-apim-service': 'sync-wrap'}) as r: - assert r.status == 200, (r.status, r.reason, (await r.text())[:2000]) - body = await r.json() + r = await api_client.get("_status", allow_retries=True, max_retries=5, headers={'x-apim-service': 'sync-wrap'}) + assert r.status == 200, (r.status, r.reason, (await r.text())[:2000]) + body = await r.json() - assert body.get('service') == 'sync-wrap' + assert body.get('service') == 'sync-wrap' @pytest.mark.asyncio From c452b7d927703d7a92e465d82bc8e67f4d8284d7 Mon Sep 17 00:00:00 2001 From: Alex Carrie Date: Fri, 15 Jan 2021 09:45:13 +0000 Subject: [PATCH 2/2] APM-1710 Change test type back to e2e --- azure/azure-pr-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure/azure-pr-pipeline.yml b/azure/azure-pr-pipeline.yml index 8e4dd73..14abcc6 100644 --- a/azure/azure-pr-pipeline.yml +++ b/azure/azure-pr-pipeline.yml @@ -40,4 +40,4 @@ extends: post_deploy: - template: templates/e2e.yml parameters: - test_type: smoketest # Change back to e2e after pr deloy test \ No newline at end of file + test_type: e2e \ No newline at end of file