Skip to content

Commit b0a26f8

Browse files
authored
Merge pull request #249 from NHSDigital/create_cohort
Create cohort
2 parents 8041902 + 67a6f89 commit b0a26f8

File tree

4 files changed

+1335
-29
lines changed

4 files changed

+1335
-29
lines changed

.github/workflows/performance-e2e.yaml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,30 @@ on:
1717
required: true
1818
type: boolean
1919
default: 'true'
20-
input_file:
21-
description: "Require: Input file name used for all steps."
20+
URN:
21+
description: "Required: what URN to run the test against."
2222
required: true
2323
type: string
2424
duration:
2525
description: "Optional (default 3600) Duration of nurse journey test, in seconds. This will include ramp-up."
2626
required: false
27-
type: number
27+
type: string
2828
threads:
2929
description: "Optional (default 70) Threads to run. Equivalent to the number of nurses using the system."
3030
required: false
31-
type: number
31+
type: string
3232
ramp_up:
3333
description: "Optional (default 900) Ramp-up time in seconds. Threads will be gradually started up over this time."
3434
required: false
35-
type: number
35+
type: string
3636
vaccination_loop:
3737
description: "Optional (default 20) Vaccination loop. The number of vaccinations each nurse will perform before logging and back in again."
3838
required: false
39-
type: number
39+
type: string
40+
row_count:
41+
description: "Optional (default 1000) number of rows in the cohort file."
42+
required: false
43+
type: string
4044

4145

4246
# env:
@@ -87,6 +91,19 @@ jobs:
8791
id: timestamp
8892
run: echo "timestamp=$(date '+%Y%m%d%H%M%S')" >> $GITHUB_ENV
8993

94+
- name: Create new cohort file
95+
if: inputs.runDataPrep == true
96+
run: |
97+
mkdir -p generate-cohort-output
98+
generate_cohort_output_dir=generate-cohort-output
99+
jmeter/bin/jmeter -n -t performance-tests/E2E/generate-cohort.jmx \
100+
-l $generate_cohort_output_dir/samples.jtl \
101+
-j $generate_cohort_output_dir/jmeter.log \
102+
-e -o $generate_cohort_output_dir/upload-report \
103+
-JAuthToken=${{secrets.HTTP_AUTH_TOKEN_FOR_TESTS}} \
104+
-JURN=${{inputs.URN}} \
105+
-JRowCount=${{inputs.row_count}}
106+
90107
- name: Run file import for new file
91108
if: inputs.runDataPrep == true
92109
run: |
@@ -97,7 +114,7 @@ jobs:
97114
-j $import_output_dir/jmeter.log \
98115
-e -o $import_output_dir/upload-report \
99116
-JAuthToken=${{secrets.HTTP_AUTH_TOKEN_FOR_TESTS}} \
100-
-JInputFile=${{inputs.input_file}}
117+
-JInputFile="cohortnew.csv"
101118
102119
- name: Run Consent Journey for imported records
103120
if: inputs.runDataPrep == true
@@ -109,7 +126,7 @@ jobs:
109126
-j $consent_output_dir/jmeter.log \
110127
-e -o $consent_output_dir/consent-report \
111128
-JAuthToken=${{secrets.HTTP_AUTH_TOKEN_FOR_TESTS}} \
112-
-JInputFile=${{inputs.input_file}}
129+
-JInputFile="cohortnew.csv"
113130
114131
- name: Run nurse journey JMeter test
115132
if: inputs.runNurse == true
@@ -125,7 +142,7 @@ jobs:
125142
-JThreads=${{inputs.threads}} \
126143
-JRampUp=${{inputs.ramp_up}} \
127144
-JVaccinationLoop=${{inputs.vaccination_loop}} \
128-
-JInputFile=${{inputs.input_file}}
145+
-JInputFile="cohortnew.csv"
129146
130147
- name: Upload consent journey JMeter output
131148
if: inputs.runDataPrep == true

.github/workflows/performance.yaml

Lines changed: 94 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Performance tests
1+
name: Performance
22

33
on:
44
push:
@@ -7,32 +7,45 @@ on:
77

88
workflow_dispatch:
99
inputs:
10-
session_slug:
11-
description: "Session slug - for a session in the QA environment. This session MUST HAVE A SESSION DATE FOR TODAY."
10+
testToRun:
11+
description: "Test to run"
12+
type: choice
13+
options:
14+
- consent-journey
15+
- nurse-journey
16+
URN:
17+
description: "Required: what URN to run the test against."
1218
required: true
1319
type: string
1420
duration:
15-
description: "Duration of test, in seconds. This will include ramp-up."
21+
description: "Optional (default 3600) Duration of selected test in seconds. This will include ramp-up."
1622
required: false
1723
type: number
1824
threads:
19-
description: "Threads to run. Equivalent to the number of nurses using the system."
25+
description: "Optional (default 70) Threads to run."
2026
required: false
2127
type: number
2228
ramp_up:
23-
description: "Ramp-up time in seconds. Threads will be gradually started up over this time."
29+
description: "Optional (default 900) Ramp-up time in seconds. Threads will be gradually started up over this time."
2430
required: false
2531
type: number
2632
vaccination_loop:
27-
description: "Vaccination loop. The number of vaccinations each nurse will perform before logging and back in again."
33+
description: "Optional (default 20) Vaccination loop (nurse journey only). The number of vaccinations each nurse will perform before logging and back in again."
2834
required: false
2935
type: number
36+
row_count:
37+
description: "Optional (default 1000) number of rows in the cohort file."
38+
required: false
39+
type: string
40+
3041

3142
# env:
3243
# JMETER_PLUGIN_INSTALL_LIST: "jpgc-udp,jpgc-graphs-basic,jpgc-dummy,bzm-random-csv"
3344

45+
# Added run-name information so it's easier to see what was run
46+
run-name: Test ${{inputs.testToRun}} run with ${{inputs.threads}} threads for ${{inputs.duration}} seconds and ${{inputs.ramp_up}} ramp up
3447
jobs:
35-
nurse_journey_performance_test:
48+
performance_test:
3649
runs-on: ubuntu-latest
3750

3851
if: ${{ github.event_name == 'workflow_dispatch' }}
@@ -56,6 +69,7 @@ jobs:
5669
curl -LsS --output jmeter/lib/ext/jmeter-plugins-manager-${{ env.jmeter_plugins_manager_version }}.jar https://jmeter-plugins.org/get/
5770
java -cp jmeter/lib/ext/jmeter-plugins-manager-${{ env.jmeter_plugins_manager_version }}.jar org.jmeterplugins.repository.PluginManagerCMDInstaller
5871
chmod +x jmeter/bin/PluginsManagerCMD.sh
72+
sed -i '/<Logger name="org.apache.jmeter.junit" level="debug" \/>/a \ <Logger name="org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase" level="info" additivity="false"\/>' jmeter/bin/log4j2.xml
5973
6074
- name: Install JMeter plugins
6175
if: env.jmeter_plugins != ''
@@ -75,24 +89,84 @@ jobs:
7589
id: timestamp
7690
run: echo "timestamp=$(date '+%Y%m%d%H%M%S')" >> $GITHUB_ENV
7791

78-
- name: Run JMeter test
92+
- name: Create new cohort file
93+
run: |
94+
mkdir -p generate-cohort-output
95+
generate_cohort_output_dir=generate-cohort-output
96+
jmeter/bin/jmeter -n -t performance-tests/E2E/generate-cohort.jmx \
97+
-l $generate_cohort_output_dir/samples.jtl \
98+
-j $generate_cohort_output_dir/jmeter.log \
99+
-e -o $generate_cohort_output_dir/upload-report \
100+
-JAuthToken=${{secrets.HTTP_AUTH_TOKEN_FOR_TESTS}} \
101+
-JURN=${{inputs.URN}} \
102+
-JRowCount=${{inputs.row_count}}
103+
104+
- name: Run file import for new file
79105
run: |
80-
mkdir -p output
81-
output_dir=output
82-
jmeter/bin/jmeter -n -t performance-tests/nurse-journey.jmx \
83-
-l $output_dir/samples.jtl \
84-
-j $output_dir/jmeter.log \
85-
-e -o $output_dir/report \
86-
-JSessionSlug=${{inputs.session_slug}} \
106+
mkdir -p import-output
107+
import_output_dir=import-output
108+
jmeter/bin/jmeter -n -t performance-tests/E2E/upload-cohort-data.jmx \
109+
-l $import_output_dir/samples.jtl \
110+
-j $import_output_dir/jmeter.log \
111+
-e -o $import_output_dir/upload-report \
112+
-JAuthToken=${{secrets.HTTP_AUTH_TOKEN_FOR_TESTS}} \
113+
-JInputFile="cohortnew.csv"
114+
115+
- name: Run Standalone Consent Journey
116+
if: inputs.testToRun == 'consent-journey'
117+
run: |
118+
mkdir -p consent-output
119+
consent_output_dir=consent-output
120+
jmeter/bin/jmeter -n -t performance-tests/E2E/consent-journey.jmx \
121+
-l $consent_output_dir/samples.jtl \
122+
-j $consent_output_dir/jmeter.log \
123+
-e -o $consent_output_dir/consent-report \
87124
-JAuthToken=${{secrets.HTTP_AUTH_TOKEN_FOR_TESTS}} \
88125
-JDuration=${{inputs.duration}} \
89126
-JThreads=${{inputs.threads}} \
90127
-JRampUp=${{inputs.ramp_up}} \
91-
-JVaccinationLoop=${{inputs.vaccination_loop}}
128+
-JInputFile="cohortnew.csv"
129+
130+
- name: Run Consent Journey for data prep only
131+
if: inputs.testToRun == 'nurse-journey'
132+
run: |
133+
mkdir -p consent-output
134+
consent_output_dir=consent-output
135+
jmeter/bin/jmeter -n -t performance-tests/E2E/consent-journey.jmx \
136+
-l $consent_output_dir/samples.jtl \
137+
-j $consent_output_dir/jmeter.log \
138+
-e -o $consent_output_dir/consent-report \
139+
-JAuthToken=${{secrets.HTTP_AUTH_TOKEN_FOR_TESTS}} \
140+
-JInputFile="cohortnew.csv"
141+
142+
- name: Run nurse journey JMeter test
143+
if: inputs.testToRun == 'nurse-journey'
144+
run: |
145+
mkdir -p nurse-output
146+
nurse_output_dir=nurse-output
147+
jmeter/bin/jmeter -n -t performance-tests/E2E/nurse-journey.jmx \
148+
-l $nurse_output_dir/samples.jtl \
149+
-j $nurse_output_dir/jmeter.log \
150+
-e -o $nurse_output_dir/report \
151+
-JAuthToken=${{secrets.HTTP_AUTH_TOKEN_FOR_TESTS}} \
152+
-JDuration=${{inputs.duration}} \
153+
-JThreads=${{inputs.threads}} \
154+
-JRampUp=${{inputs.ramp_up}} \
155+
-JVaccinationLoop=${{inputs.vaccination_loop}} \
156+
-JInputFile="cohortnew.csv"
157+
158+
- name: Upload consent journey JMeter output
159+
if: inputs.testToRun == 'consent-journey'
160+
uses: actions/upload-artifact@v4
161+
with:
162+
name: jmeter-consent-journey-output-${{ env.timestamp }}
163+
path: consent-output
164+
if-no-files-found: warn
92165

93-
- name: Upload JMeter output
166+
- name: Upload nurse journey JMeter output
167+
if: inputs.testToRun == 'nurse-journey'
94168
uses: actions/upload-artifact@v4
95169
with:
96170
name: jmeter-nurse-journey-output-${{ env.timestamp }}
97-
path: output
98-
if-no-files-found: error
171+
path: nurse-output
172+
if-no-files-found: warn

0 commit comments

Comments
 (0)