Skip to content

Commit 87f5fe5

Browse files
Chore: [AEA-5853] - New supplier NHS Number testing parameters (#2097)
## Summary - 🤖 Operational or Infrastructure Change ### Details Create new params to configure forced exceptions required by test plans. --------- Signed-off-by: Connor Avery <[email protected]> Co-authored-by: Connor Avery <[email protected]>
1 parent 6d72649 commit 87f5fe5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1321
-196
lines changed

.github/scripts/release_code.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,7 @@ sam deploy \
4949
ToggleGetStatusUpdates="$TOGGLE_GET_STATUS_UPDATES" \
5050
EnableAlerts="$ENABLE_ALERTS" \
5151
StateMachineLogLevel="$STATE_MACHINE_LOG_LEVEL" \
52-
ForwardCsocLogs="$FORWARD_CSOC_LOGS"
52+
ForwardCsocLogs="$FORWARD_CSOC_LOGS" \
53+
TC007NHSNumberValue="$TC007_NHS_NUMBERS" \
54+
TC008NHSNumberValue="$TC008_NHS_NUMBERS" \
55+
TC009NHSNumberValue="$TC009_NHS_NUMBERS"

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ jobs:
7575
RUN_REGRESSION_TESTS: true
7676
REGRESSION_TEST_PRODUCT: PFP-APIGEE
7777
FORWARD_CSOC_LOGS: false
78+
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
79+
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
80+
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
7881
secrets:
7982
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
8083
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
@@ -103,6 +106,9 @@ jobs:
103106
STATE_MACHINE_LOG_LEVEL: ALL
104107
RUN_REGRESSION_TESTS: false
105108
FORWARD_CSOC_LOGS: false
109+
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
110+
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
111+
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
106112
secrets:
107113
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
108114
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
@@ -136,6 +142,9 @@ jobs:
136142
STATE_MACHINE_LOG_LEVEL: ERROR
137143
RUN_REGRESSION_TESTS: false
138144
FORWARD_CSOC_LOGS: false
145+
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
146+
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
147+
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
139148
secrets:
140149
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
141150
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.REF_CLOUD_FORMATION_DEPLOY_ROLE }}
@@ -170,6 +179,9 @@ jobs:
170179
RUN_REGRESSION_TESTS: true
171180
REGRESSION_TEST_PRODUCT: PFP-APIGEE
172181
FORWARD_CSOC_LOGS: false
182+
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
183+
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
184+
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
173185
secrets:
174186
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
175187
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.QA_CLOUD_FORMATION_DEPLOY_ROLE }}
@@ -199,6 +211,9 @@ jobs:
199211
RUN_REGRESSION_TESTS: true
200212
REGRESSION_TEST_PRODUCT: PFP-APIGEE
201213
FORWARD_CSOC_LOGS: false
214+
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
215+
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
216+
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
202217
secrets:
203218
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
204219
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.INT_CLOUD_FORMATION_DEPLOY_ROLE }}

.github/workflows/sam_release_code.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ on:
6666
FORWARD_CSOC_LOGS:
6767
required: true
6868
type: boolean
69+
TC007_NHS_NUMBERS:
70+
required: false
71+
type: string
72+
TC008_NHS_NUMBERS:
73+
required: false
74+
type: string
75+
TC009_NHS_NUMBERS:
76+
required: false
77+
type: string
6978
secrets:
7079
CLOUD_FORMATION_DEPLOY_ROLE:
7180
required: true
@@ -146,6 +155,9 @@ jobs:
146155
ENABLE_ALERTS: ${{ inputs.ENABLE_ALERTS }}
147156
STATE_MACHINE_LOG_LEVEL: ${{ inputs.STATE_MACHINE_LOG_LEVEL }}
148157
FORWARD_CSOC_LOGS: ${{ inputs.FORWARD_CSOC_LOGS }}
158+
TC007_NHS_NUMBERS: ${{ inputs.TC007_NHS_NUMBERS || '9992387920' }}
159+
TC008_NHS_NUMBERS: ${{ inputs.TC008_NHS_NUMBERS || '9992387920' }}
160+
TC009_NHS_NUMBERS: ${{ inputs.TC009_NHS_NUMBERS || '9992387920' }}
149161
run: ./release_code.sh
150162

151163
- name: create_int_release_notes

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ repos:
8686
types_or: [ts, tsx, javascript, jsx, json]
8787
pass_filenames: false
8888

89+
- id: lint-common-utilities
90+
name: Lint common utilities
91+
entry: npm
92+
args: ["run", "--prefix=packages/common/utilities", "lint"]
93+
language: system
94+
files: ^packages\/common\/src
95+
types_or: [ts, tsx, javascript, jsx, json]
96+
pass_filenames: false
97+
8998
- id: lint-common-testing
9099
name: Lint common testing
91100
entry: npm

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ lint-node: compile-node
125125
npm run lint --workspace packages/nhsd-pfp-sandbox
126126
npm run lint --workspace packages/statusLambda
127127
npm run lint --workspace packages/serviceSearchClient
128+
npm run lint --workspace packages/common/utilities
128129
npm run lint --workspace packages/common/testing
129130
npm run lint --workspace packages/distanceSelling
130131

@@ -147,6 +148,8 @@ test: compile
147148
npm run test --workspace packages/statusLambda
148149
npm run test --workspace packages/serviceSearchClient
149150
npm run test --workspace packages/distanceSelling
151+
npm run test --workspace packages/common/utilities
152+
npm run test --workspace packages/common/testing
150153

151154
clean:
152155
rm -rf packages/capabilityStatement/coverage
@@ -165,6 +168,7 @@ clean:
165168
rm -rf packages/distanceSelling/lib
166169
rm -rf packages/statusLambda/lib
167170
rm -rf packages/getSecretLayer/lib
171+
rm -rf packages/common/utilities/lib
168172
rm -rf packages/common/testing/lib
169173
rm -rf .aws-sam
170174

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ It is called by an Apigee proxy that is defined at <https://github.com/NHSDigita
2121
- `packages/capabilityStatement/` Returns a static capability statement.
2222
- `packages/serviceSearchClient/` Module for connecting to service search.
2323
- `packages/distanceSelling/` Module for using Service Search client and enriching the data being returned.
24+
- `packages/common/utilities` Module containing commonly referenced functions, data types and configuration data.
2425
- `packages/common/testing` Module that contains some test data used for tests in other modules.
2526
- `postman/` Contains a postman collection for interacting with the API.
2627
- `scripts/` Utilities helpful to developers of this specification.

SAMtemplates/functions/main.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Globals:
1212
Runtime: nodejs20.x
1313
Environment:
1414
Variables:
15+
STACK_NAME: !Ref StackName
1516
NODE_OPTIONS: "--enable-source-maps"
1617
TargetSpineServer: !Ref TargetSpineServer
1718
TargetServiceSearchServer: !Ref TargetServiceSearchServer
@@ -64,6 +65,9 @@ Parameters:
6465
ToggleGetStatusUpdates:
6566
Type: String
6667

68+
SSMParameterPolicy:
69+
Type: String
70+
6771
Resources:
6872
GetSecretsLayer:
6973
Type: AWS::Serverless::LayerVersion
@@ -116,6 +120,7 @@ Resources:
116120
AdditionalPolicies: !Join
117121
- ","
118122
- - !ImportValue account-resources:LambdaAccessSecretsPolicy
123+
- !Ref SSMParameterPolicy
119124
LogRetentionInDays: !Ref LogRetentionInDays
120125
CloudWatchKMSKeyId: !ImportValue account-resources:CloudwatchLogsKmsKeyArn
121126
EnableSplunk: !Ref EnableSplunk
@@ -163,6 +168,10 @@ Resources:
163168
EnableSplunk: !Ref EnableSplunk
164169
SplunkSubscriptionFilterRole: !ImportValue lambda-resources:SplunkSubscriptionFilterRole
165170
SplunkDeliveryStreamArn: !ImportValue lambda-resources:SplunkDeliveryStream
171+
IncludeAdditionalPolicies: true
172+
AdditionalPolicies: !Join
173+
- ","
174+
- - !Ref SSMParameterPolicy
166175

167176
CapabilityStatement:
168177
Type: AWS::Serverless::Function

SAMtemplates/main_template.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,25 @@ Parameters:
9595

9696
StateMachineLogLevel:
9797
Type: String
98+
Default: ERROR
99+
AllowedValues:
100+
- ALL
101+
- ERROR
102+
- FATAL
103+
- OFF
104+
Description: Logging level for Step Functions state machine
105+
106+
TC007NHSNumberValue:
107+
Type: String
108+
Default: "123"
109+
110+
TC008NHSNumberValue:
111+
Type: String
112+
Default: "123"
113+
114+
TC009NHSNumberValue:
115+
Type: String
116+
Default: "123"
98117

99118
ForwardCsocLogs:
100119
Type: String
@@ -123,6 +142,16 @@ Resources:
123142
EnableSplunk: !Ref EnableSplunk
124143
ForwardCsocLogs: !Ref ForwardCsocLogs
125144

145+
Parameters:
146+
Type: AWS::Serverless::Application
147+
Properties:
148+
Location: parameters/main.yaml
149+
Parameters:
150+
StackName: !Ref AWS::StackName
151+
TC007NHSNumberValue: !Ref TC007NHSNumberValue
152+
TC008NHSNumberValue: !Ref TC008NHSNumberValue
153+
TC009NHSNumberValue: !Ref TC009NHSNumberValue
154+
126155
Functions:
127156
Type: AWS::Serverless::Application
128157
Properties:
@@ -138,6 +167,7 @@ Resources:
138167
VersionNumber: !Ref VersionNumber
139168
CommitId: !Ref CommitId
140169
ToggleGetStatusUpdates: !Ref ToggleGetStatusUpdates
170+
SSMParameterPolicy: !GetAtt Parameters.Outputs.GetPfPParameterPolicy
141171

142172
StateMachines:
143173
Type: AWS::Serverless::Application

SAMtemplates/parameters/main.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Description: >-
3+
SSM Parameter Store entries. Values may differ between prod and non-prod environments
4+
5+
Parameters:
6+
StackName:
7+
Type: String
8+
9+
TC007NHSNumberValue:
10+
Type: String
11+
12+
TC008NHSNumberValue:
13+
Type: String
14+
15+
TC009NHSNumberValue:
16+
Type: String
17+
18+
Resources:
19+
TC007NHSNumberParameter:
20+
Type: AWS::SSM::Parameter
21+
Properties:
22+
Name: !Sub ${StackName}-TC007NHSNumber
23+
Description: "List of NHS numbers that will trigger 'temporarily unavailable' response for testing purposes."
24+
Type: String
25+
Value: !Ref TC007NHSNumberValue
26+
27+
TC008NHSNumberParameter:
28+
Type: AWS::SSM::Parameter
29+
Properties:
30+
Name: !Sub ${StackName}-TC008NHSNumber
31+
Description: "List of NHS numbers that will trigger '500 system error' response for testing purposes."
32+
Type: String
33+
Value: !Ref TC008NHSNumberValue
34+
35+
TC009NHSNumberParameter:
36+
Type: AWS::SSM::Parameter
37+
Properties:
38+
Name: !Sub ${StackName}-TC009NHSNumber
39+
Description: "List of NHS numbers that will trigger 'one or more prescriptions missing' response for testing purposes."
40+
Type: String
41+
Value: !Ref TC009NHSNumberValue
42+
43+
GetPfPParameterPolicy:
44+
Type: AWS::IAM::ManagedPolicy
45+
Properties:
46+
Description: "Allows reading SSM parameters"
47+
PolicyDocument:
48+
Version: 2012-10-17
49+
Statement:
50+
- Effect: Allow
51+
Action:
52+
- ssm:GetParameter
53+
- ssm:GetParameters
54+
Resource:
55+
- !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${TC007NHSNumberParameter}
56+
- !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${TC008NHSNumberParameter}
57+
- !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${TC009NHSNumberParameter}
58+
59+
Outputs:
60+
TC007NHSNumberParameterName:
61+
Description: "Name of the SSM parameter holding TC007_NHS_Number"
62+
Value: !Ref TC007NHSNumberParameter
63+
Export:
64+
Name: !Sub ${StackName}-TC007NHSNumberParameter
65+
66+
TC008NHSNumberParameterName:
67+
Description: "Name of the SSM parameter holding TC008_NHS_Number"
68+
Value: !Ref TC008NHSNumberParameter
69+
Export:
70+
Name: !Sub ${StackName}-TC008NHSNumberParameter
71+
72+
TC009NHSNumberParameterName:
73+
Description: "Name of the SSM parameter holding TC009_NHS_Number"
74+
Value: !Ref TC009NHSNumberParameter
75+
Export:
76+
Name: !Sub ${StackName}-TC009NHSNumberParameter
77+
78+
GetPfPParameterPolicy:
79+
Description: Access to the parameters used by the notifications integration
80+
Value: !Ref GetPfPParameterPolicy
81+
Export:
82+
Name: !Sub ${StackName}-GetPfPParameterPolicy

jest.default.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ const jestConfig: JestConfigWithTsJest = {
1010
preset: "ts-jest/presets/default-esm",
1111
moduleFileExtensions: ["js", "json", "ts", "d.ts"],
1212
moduleNameMapper: {
13-
"^(\\.{1,2}/.*)\\.js$": "$1"
13+
"^(\\.{1,2}/.*)\\.js$": "$1",
14+
"^@pfp-common/testing$": "<rootDir>/../../packages/common/testing/lib/index.js",
15+
"^@pfp-common/testing/(.*)$": "<rootDir>/../../packages/common/testing/lib/$1.js",
16+
"^@pfp-common/utilities$": "<rootDir>/../../packages/common/utilities/lib/index.js",
17+
"^@pfp-common/utilities/(.*)$": "<rootDir>/../../packages/common/utilities/lib/$1.js"
1418
},
1519
transform: {
1620
"^.+\\.ts?$": [

0 commit comments

Comments
 (0)