Skip to content

Commit 35b16ca

Browse files
committed
[NRL-604] Sideline producer K6 tests as they don't play nicely with github actions
1 parent ae0f076 commit 35b16ca

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ test-performance-baseline:
9393
test-performance-stress:
9494
@echo "Running consumer performance stress test"
9595
k6 run --out csv=$(DIST_PATH)/consumer-stress.csv tests/performance/consumer/stress.js -e HOST=$(HOST) -e ENV_TYPE=$(ENV_TYPE)
96-
@echo "Running producer performance stress test"
97-
k6 run --out csv=$(DIST_PATH)/producer-stress.csv tests/performance/producer/stress.js -e HOST=$(HOST) -e ENV_TYPE=$(ENV_TYPE)
9896

9997
test-performance-soak:
10098
@echo "Running consumer performance soak test"

tests/performance/constants.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ export const DEFAULT_TEST_RECORD = open(
33
);
44
export const ODS_CODE = "Y05868";
55
export const REFERENCE_DATA = JSON.parse(open("./reference-data.json"));
6-
export const POINTER_DOCUMENTS = REFERENCE_DATA["documents"];
7-
export const ALL_POINTER_IDS = Object.keys(POINTER_DOCUMENTS);
6+
export const POINTER_DOCUMENTS =
7+
"documents" in REFERENCE_DATA ? REFERENCE_DATA["documents"] : {};
8+
export const ALL_POINTER_IDS =
9+
"pointer_ids" in REFERENCE_DATA
10+
? REFERENCE_DATA["pointer_ids"]
11+
: Object.keys(POINTER_DOCUMENTS);
812
export const POINTERS_TO_DELETE = ALL_POINTER_IDS.slice(0, 3500);
913
export const POINTER_IDS = ALL_POINTER_IDS.slice(3500);
1014
export const NHS_NUMBERS = REFERENCE_DATA["nhs_numbers"];

tests/performance/environment.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def setup(
5858
documents_per_type: int = 10,
5959
ods_code: str = "Y05868",
6060
out: str = "tests/performance/reference-data.json",
61+
output_full_pointers: bool = False,
6162
):
6263
print(f"Creating Test Data in environment '{env}'")
6364

@@ -77,7 +78,13 @@ def setup(
7778
nhs_numbers.add(pointer.nhs_number)
7879

7980
print(f"Created {len(documents)} documents for {len(nhs_numbers)} patients")
80-
output = json.dumps({"documents": documents, "nhs_numbers": list(nhs_numbers)})
81+
82+
if output_full_pointers:
83+
output = json.dumps({"documents": documents, "nhs_numbers": list(nhs_numbers)})
84+
else:
85+
output = json.dumps(
86+
{"pointer_ids": list(documents.keys()), "nhs_numbers": list(nhs_numbers)}
87+
)
8188

8289
output_path = pathlib.Path(out)
8390
output_path.write_text(output)
@@ -88,12 +95,15 @@ def cleanup(env: str, input: str = "tests/performance/reference-data.json"):
8895
input_path = pathlib.Path(input)
8996
data = json.loads(input_path.read_text())
9097

91-
documents = data["documents"]
98+
if "documents" in data:
99+
pointer_ids = data["documents"].keys()
100+
else:
101+
pointer_ids = data["pointer_ids"]
92102

93-
print(f"Cleaning up {len(documents)} document pointers in environment '{env}'")
103+
print(f"Cleaning up {len(pointer_ids)} document pointers in environment '{env}'")
94104
table = DYNAMODB.Table(f"nhsd-nrlf--{env}--document-pointer")
95105
with table.batch_writer() as batch:
96-
for id in documents.keys():
106+
for id in pointer_ids:
97107
ods_code, document_id = id.split("-", maxsplit=1)
98108
pk = f"D#{ods_code}#{document_id}"
99109
batch.delete_item(Key={"pk": pk, "sk": pk})

tests/performance/producer/stress.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
export * from "./client.js";
22

3+
/*
4+
* NOTE - To run the producer K6 tests, you need to prepare the data by setting
5+
* the output_full_pointers flag to true in the environment.py:setup() method.
6+
*/
7+
38
export const options = {
49
tlsAuth: [
510
{

0 commit comments

Comments
 (0)