Skip to content

Commit 8565140

Browse files
committed
Get the requests going. Seems to work now
1 parent b0aa7c1 commit 8565140

5 files changed

Lines changed: 17 additions & 27 deletions

File tree

artillery/helper/odscodes.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export const allowedOdsCodes = [
44
]
55

66
export const blockedOdsCodes = [
7-
"B3J1Z"
7+
// "B3J1Z"
88
]

artillery/helper/psu.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ export async function getPSUParams(requestParams, vuContext) {
132132
const isValid = vuContext.scenario.tags.isValid
133133
const body = getBody(isValid)
134134

135-
requestParams.json = body
136135
// This sets the body of the request and some variables so headers are unique
137136
requestParams.json = body
138137
vuContext.vars.x_request_id = uuidv4()

artillery/notify_entrypoint.mjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,20 @@ export function generatePrescData(requestParams, context, ee, next) {
8080
logger.info(`Generating a prescription for patient ${context.vars.nhsNumber}`)
8181
const body = getBody(
8282
true, /* isValid */
83-
"ready to collect", /* status */
83+
"completed", /* status */
8484
context.vars.odsCode, /* odsCode */
85-
context.vars.nhsNumber /* nhsNumber */
85+
context.vars.nhsNumber, /* nhsNumber */
86+
"ready to collect" /* Item status */
8687
)
88+
// The body is fine - it works when I put it in postman
8789

8890
requestParams.json = body
8991
context.vars.x_request_id = uuidv4()
9092
context.vars.x_correlation_id = uuidv4()
9193

9294
// Wait this long between requests
93-
let delay = sampleNormal(150, 60)
94-
if (delay < 0) delay = 0
95+
let delay = sampleNormal(60, 60)
96+
while (delay < 0) delay = sampleNormal(60, 60)
9597
context.vars.nextDelay = delay
9698
logger.info(`Patient ${context.vars.nhsNumber} will think for ${context.vars.nextDelay} seconds`)
9799

artillery/notify_load_test.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
config:
22
processor: "./notify_entrypoint.mjs"
3+
plugins:
4+
expect: {}
5+
apdex: {}
36
phases:
4-
- name: ramp up phase
5-
duration: "{{ $env.rampUpDuration }}"
6-
arrivalRate: 1
7-
rampTo: "{{ $env.arrivalRate }}"
8-
maxVusers: "{{ $env.maxVusers }}"
97
- name: run phase
108
duration: "{{ $env.duration }}"
119
arrivalRate: "{{ $env.arrivalRate }}"
@@ -19,17 +17,14 @@ config:
1917
target: https://int.api.service.nhs.uk/
2018
pr:
2119
target: https://psu-pr-{{ prNumber }}.dev.eps.national.nhs.uk/
22-
defaults:
23-
headers:
24-
Authorization: "Bearer {{ authToken }}"
20+
21+
before:
22+
flow:
23+
- function: getSharedAuthToken
2524

2625
scenarios:
2726
- name: dynamic PSU calls for each patient
2827

29-
# grab token once per VU
30-
before:
31-
- function: getSharedAuthToken
32-
3328
flow:
3429
- function: initUser
3530

@@ -39,9 +34,10 @@ scenarios:
3934
url: "/prescription-status-update/"
4035
beforeRequest: "generatePrescData"
4136
headers:
37+
Authorization: "Bearer {{ authToken }}"
4238
x-request-id: "{{ x_request_id }}"
4339
x-correlation-id: "{{ x_correlation_id }}"
4440
expect:
4541
- statusCode: 201
46-
- think: "{{ nextDelay }}"
42+
- think: "{{ nextDelay }}seconds"
4743
count: "{{ prescriptionCount }}"

scripts/test_notify_load_test.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ if [ -z "${arrivalRate}" ]; then
2121
exit 1
2222
fi
2323

24-
if [ -z "${rampUpDuration}" ]; then
25-
echo "rampUpDuration is unset or set to the empty string"
26-
exit 1
27-
fi
28-
2924
if [ -z "${psu_api_key}" ]; then
3025
echo "psu_api_key is unset or set to the empty string"
3126
exit 1
@@ -47,7 +42,6 @@ cat <<EOF > runtimeenv.env
4742
maxVusers=${maxVusers}
4843
duration=${duration}
4944
arrivalRate=${arrivalRate}
50-
rampUpDuration=${rampUpDuration}
5145
psu_api_key="${psu_api_key}"
5246
psu_private_key="${psu_private_key}"
5347
psu_kid="${psu_kid}"
@@ -57,9 +51,8 @@ echo "Running Artillery test locally..."
5751
echo ""
5852
echo "Environment: ${environment}"
5953
echo "Max Virtual Users: ${maxVusers}"
60-
echo "Phase Duration: ${duration}"
54+
echo "Run Phase Duration: ${duration}"
6155
echo "Arrival Rate: ${arrivalRate}"
62-
echo "Ramp Up Duration: ${rampUpDuration}"
6356
echo ""
6457

6558
set -e

0 commit comments

Comments
 (0)