Skip to content

Commit 9f40f5b

Browse files
authored
Merge pull request #6 from NHSDigital/AMB-577-consume-user-role-sharedflow
AMB-577 consume user-role shared flow
2 parents 606b001 + 4dc5c11 commit 9f40f5b

File tree

9 files changed

+222
-73
lines changed

9 files changed

+222
-73
lines changed

azure/azure-pr-pipeline.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ extends:
3939
- environment: internal-dev
4040
make_spec_visible: true
4141
post_deploy:
42-
- template: ./templates/run-smoke-tests.yml
42+
# - template: ./templates/run-smoke-tests.yml
43+
- template: ./templates/run-integration-tests.yml
44+
parameters:
45+
service_name: ${{ variables.service_name }}
4346
# - environment: internal-dev-sandbox
4447
# proxy_path: sandbox
4548
# post_deploy:
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
parameters:
2+
- name: service_name
3+
type: string
4+
5+
steps:
6+
- bash: |
7+
pip install virtualenv
8+
virtualenv test_env
9+
source ./test_env/bin/activate
10+
pip install -r requirements.txt
11+
workingDirectory: $(Pipeline.Workspace)/s/${{ parameters.service_name }}/$(SERVICE_ARTIFACT_NAME)/tests
12+
displayName: Setup integration tests
13+
14+
- bash: |
15+
source ./test_env/bin/activate
16+
export OAUTH_BASE_URI="https://$(APIGEE_ENVIRONMENT).api.service.nhs.uk"
17+
export OAUTH_PROXY="oauth2"
18+
export SERVICE_NAME="$(FULLY_QUALIFIED_SERVICE_NAME)"
19+
export ID_TOKEN_PRIVATE_KEY_ABSOLUTE_PATH="$(Pipeline.Workspace)/secrets/$(ID_TOKEN_TESTING_PRIVATE_KEY)"
20+
export JWT_PRIVATE_KEY_ABSOLUTE_PATH="$(Pipeline.Workspace)/secrets/$(JWT_TESTING_PRIVATE_KEY)"
21+
export APIGEE_API_TOKEN="$(secret.AccessToken)"
22+
pytest --reruns 5 --reruns-delay 1 -v --junitxml=test-report.xml
23+
workingDirectory: $(Pipeline.Workspace)/s/${{ parameters.service_name }}/$(SERVICE_ARTIFACT_NAME)/tests
24+
displayName: Run integration tests
25+
26+
- task: PublishTestResults@2
27+
displayName: 'Publish integration test results'
28+
condition: always()
29+
inputs:
30+
testResultsFiles: '$(Pipeline.Workspace)/s/${{ parameters.service_name }}/$(SERVICE_ARTIFACT_NAME)/tests/test-report.xml'
31+
failTaskOnFailedTests: true

poetry.lock

Lines changed: 80 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<FlowCallout async="false" continueOnError="false" enabled="true" name="FlowCallout.UserRoleService">
3+
<DisplayName>FlowCallout.UserRoleService</DisplayName>
4+
<FaultRules/>
5+
<Properties/>
6+
<SharedFlowBundle>UserRoleService</SharedFlowBundle>
7+
</FlowCallout>

proxies/live/apiproxy/proxies/default.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<ProxyEndpoint name="default">
22
<Flows>
3+
<Flow name="UserRoleService">
4+
<Request>
5+
<Step>
6+
<Name>FlowCallout.UserRoleService</Name>
7+
</Step>
8+
</Request>
9+
<Condition>proxy.pathsuffix MatchesPath "/user-role-service"</Condition>
10+
</Flow>
311
<Flow name="OptionsPreFlight">
412
<Request/>
513
<Response>
@@ -62,9 +70,9 @@
6270
<RouteRule name="shared-flow-testing-target">
6371
<TargetEndpoint>shared-flow-testing-target</TargetEndpoint>
6472
</RouteRule>
65-
<DefaultFaultRule>
73+
<!-- <DefaultFaultRule>
6674
<Step>
6775
<Name>AssignMessage.Errors.CatchAllMessage</Name>
6876
</Step>
69-
</DefaultFaultRule>
77+
</DefaultFaultRule> -->
7078
</ProxyEndpoint>

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ keywords = ["healthcare", "uk", "nhs"] #TODO add additional keywords
1717

1818
[tool.poetry.dependencies]
1919
python = "^3.8"
20+
requests = "^2.25.1"
21+
assertpy = "^1.1"
2022

2123
[tool.poetry.dev-dependencies]
2224
flake8 = "^3.7.9"
@@ -32,6 +34,6 @@ pytest = "^6.1.2"
3234
coverage = "^5.5"
3335
aiohttp = "^3.7.3"
3436
pytest-asyncio = "^0.14.0"
35-
api-test-utils = {url = "https://github.com/NHSDigital/apim-test-utils/releases/download/v1.0.92-alpha/api_test_utils-1.0.92a0-py3-none-any.whl"}
37+
api-test-utils = {url = "https://github.com/NHSDigital/apim-test-utils/releases/download/v1.1.2-alpha/api_test_utils-1.1.2a0-py3-none-any.whl"}
3638

3739
[tool.poetry.scripts]

0 commit comments

Comments
 (0)