Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPINEDEM-1680 - Reduce rerun count #919

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions azure/templates/pds-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ steps:
export OAUTH_BASE_URI="https://$(ENVIRONMENT).api.service.nhs.uk"
export INTERNAL_DEV_ASID="$(INTERNAL_DEV_ASID)"

poetry run pytest -v tests/user_restricted/test_user_restricted.py --api-name=personal-demographics-service --proxy-name "$(FULLY_QUALIFIED_SERVICE_NAME)" --junitxml=tests/user-restricted-test-report.xml --reruns 20 --reruns-delay 1
poetry run pytest -v tests/user_restricted/test_user_restricted.py --api-name=personal-demographics-service --proxy-name "$(FULLY_QUALIFIED_SERVICE_NAME)" --junitxml=tests/user-restricted-test-report.xml --reruns 3 --reruns-delay 1
displayName: Run user restricted tests
workingDirectory: "$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)"
- task: PublishTestResults@2
Expand Down Expand Up @@ -117,6 +117,6 @@ steps:
export TEST_PATIENT_ID="$(TEST_PATIENT_ID)"
export INTERNAL_DEV_ASID="$(INTERNAL_DEV_ASID)"

poetry run pytest -v tests/functional/test_patient_access.py --api-name=personal-demographics-service --proxy-name "$(FULLY_QUALIFIED_SERVICE_NAME)" --junitxml=tests/patient-access-test-report.xml --reruns 20 --reruns-delay 1
poetry run pytest -v tests/functional/test_patient_access.py --api-name=personal-demographics-service --proxy-name "$(FULLY_QUALIFIED_SERVICE_NAME)" --junitxml=tests/patient-access-test-report.xml --reruns 3 --reruns-delay 1
displayName: Run patient access tests
workingDirectory: "$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)"
1 change: 1 addition & 0 deletions tests/user_restricted/configuration/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@
}

TEST_PATIENT_ID = ENV["test_patient_id"]
DEVELOPER_EMAIL = "[email protected]"
18 changes: 14 additions & 4 deletions tests/user_restricted/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import uuid
import random
from ..scripts import config
from .configuration.config import DEVELOPER_EMAIL
from tests.functional.config_files import config as functional_config
from pytest_nhsd_apim.apigee_apis import (
ApigeeClient,
Expand All @@ -14,7 +15,6 @@
import logging

LOGGER = logging.getLogger(__name__)
DEVELOPER_EMAIL = "[email protected]"


@pytest.fixture()
Expand Down Expand Up @@ -57,16 +57,26 @@ def add_asid_to_testapp(developer_apps, nhsd_apim_test_app):
response = developer_apps.post_app_attributes(email=DEVELOPER_EMAIL, app_name=app_name, body=data)
LOGGER.info(f'Test app updated with ASID attribute: {response}')

_MAX_RETRY = 20
retry_count = 0

while retry_count < _MAX_RETRY:
LOGGER.info(f'Waiting for AISD to be applied to app. Retry: {retry_count}')
app_attributes = developer_apps.get_app_attributes(email=DEVELOPER_EMAIL, app_name=app_name)
custom_attributes = app_attributes['attribute']
if 'asid' in [attribute['name'] for attribute in custom_attributes]:
break
retry_count += 1


@pytest.fixture()
async def headers_with_token(
add_asid_to_testapp,
_nhsd_apim_auth_token_data,
request,
identity_service_base_url,
nhsd_apim_test_app,
client,
api_products,
add_asid_to_testapp
api_products
):
"""Assign required headers with the Authorization header"""

Expand Down
Loading