Skip to content

Commit f606179

Browse files
committed
NRL-1053 fix performance tests
1 parent 912137f commit f606179

File tree

5 files changed

+61
-11
lines changed

5 files changed

+61
-11
lines changed

tests/performance/consumer/baseline.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,16 @@ export const options = {
6363
{ target: 5, duration: "1m" },
6464
],
6565
},
66+
searchPostDocumentReferenceByCategory: {
67+
exec: "searchPostDocumentReferenceByCategory",
68+
executor: "ramping-arrival-rate",
69+
startRate: 1,
70+
timeUnit: "1s",
71+
preAllocatedVUs: 5,
72+
stages: [
73+
{ target: 5, duration: "30s" },
74+
{ target: 5, duration: "1m" },
75+
],
76+
},
6677
},
6778
};

tests/performance/consumer/client.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,22 @@ export function searchPostDocumentReference() {
123123
);
124124
checkResponse(res);
125125
}
126+
127+
export function searchPostDocumentReferenceByCategory() {
128+
const nhsNumber = NHS_NUMBERS[Math.floor(Math.random() * NHS_NUMBERS.length)];
129+
const category = CATEGORIES[Math.floor(Math.random() * CATEGORIES.length)];
130+
131+
const body = JSON.stringify({
132+
"subject:identifier": `https://fhir.nhs.uk/Id/nhs-number|${nhsNumber}`,
133+
category: `http://snomed.info/sct|${category}`,
134+
});
135+
136+
const res = http.post(
137+
`https://${__ENV.HOST}/consumer/DocumentReference/_search`,
138+
body,
139+
{
140+
headers: getHeaders(),
141+
}
142+
);
143+
checkResponse(res);
144+
}

tests/performance/consumer/soak.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ export const options = {
4747
searchDocumentReferenceByCategory: {
4848
exec: "searchDocumentReferenceByCategory",
4949
executor: "ramping-arrival-rate",
50-
startRate: 1,
50+
startRate: 0,
5151
timeUnit: "1s",
5252
preAllocatedVUs: 5,
5353
stages: [
54-
{ target: 5, duration: "30s" },
55-
{ target: 5, duration: "1m" },
54+
{ target: 10, duration: "5m" },
55+
{ target: 10, duration: "30m" },
56+
{ target: 0, duration: "1m" },
5657
],
5758
},
5859
searchPostDocumentReference: {
@@ -67,5 +68,17 @@ export const options = {
6768
{ target: 0, duration: "1m" },
6869
],
6970
},
71+
searchPostDocumentReferenceByCategory: {
72+
exec: "searchPostDocumentReferenceByCategory",
73+
executor: "ramping-arrival-rate",
74+
startRate: 0,
75+
timeUnit: "1s",
76+
preAllocatedVUs: 5,
77+
stages: [
78+
{ target: 10, duration: "5m" },
79+
{ target: 10, duration: "30m" },
80+
{ target: 0, duration: "1m" },
81+
],
82+
},
7083
},
7184
};

tests/performance/consumer/stress.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@ export const options = {
3737
},
3838
searchDocumentReferenceByCategory: {
3939
exec: "searchDocumentReferenceByCategory",
40-
executor: "ramping-arrival-rate",
41-
startRate: 1,
42-
timeUnit: "1s",
43-
preAllocatedVUs: 5,
40+
executor: "ramping-vus",
41+
startVUs: 1,
4442
stages: [
45-
{ target: 5, duration: "30s" },
46-
{ target: 5, duration: "1m" },
43+
{ target: 10, duration: "30s" },
44+
{ target: 10, duration: "1m" },
4745
],
4846
},
4947
searchPostDocumentReference: {
@@ -55,5 +53,14 @@ export const options = {
5553
{ target: 10, duration: "1m" },
5654
],
5755
},
56+
searchPostDocumentReferenceByCategory: {
57+
exec: "searchPostDocumentReferenceByCategory",
58+
executor: "ramping-vus",
59+
startVUs: 1,
60+
stages: [
61+
{ target: 10, duration: "30s" },
62+
{ target: 10, duration: "1m" },
63+
],
64+
},
5865
},
5966
};

tests/performance/process_results.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _create_response_count_figure(data: dict, title: str):
8080
fig_labels.add(f"Failure - Status Code {failure.status}")
8181

8282
for index, scenario in enumerate(data.keys()):
83-
axes = fig.add_subplot(2, 2, index + 1)
83+
axes = fig.add_subplot(3, 3, index + 1)
8484
scenario_data = data[scenario]
8585

8686
timestamps = []
@@ -149,7 +149,7 @@ def _create_response_time_figure(data: dict, title: str):
149149
fig.suptitle(title)
150150

151151
for index, scenario in enumerate(data.keys()):
152-
axes = fig.add_subplot(2, 2, index + 1)
152+
axes = fig.add_subplot(3, 3, index + 1)
153153
scenario_data = data[scenario]
154154

155155
timestamps = []

0 commit comments

Comments
 (0)