-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_cpsu_load_test.sh
More file actions
executable file
·62 lines (49 loc) · 1.41 KB
/
test_cpsu_load_test.sh
File metadata and controls
executable file
·62 lines (49 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
if [ -z "${environment}" ]; then
echo "environment is unset or set to the empty string"
exit 1
fi
if [ -z "${maxVusers}" ]; then
echo "maxVusers is unset or set to the empty string"
exit 1
fi
if [ -z "${duration}" ]; then
echo "duration is unset or set to the empty string"
exit 1
fi
if [ -z "${arrivalRate}" ]; then
echo "arrivalRate is unset or set to the empty string"
exit 1
fi
if [ -z "${rampUpDuration}" ]; then
echo "rampUpDuration is unset or set to the empty string"
exit 1
fi
if [ -z "${cpsu_api_key}" ]; then
echo "cpsu_api_key is unset or set to the empty string"
exit 1
fi
# Create a dotenv file with the variables for Artillery
cat <<EOF > runtimeenv.env
maxVusers=${maxVusers}
duration=${duration}
arrivalRate=${arrivalRate}
rampUpDuration=${rampUpDuration}
cpsu_api_key="${cpsu_api_key}"
EOF
echo "Running Artillery test locally..."
echo ""
echo "Max Virtual Users: ${maxVusers}"
echo "Phase Duration: ${duration}"
echo "Arrival Rate: ${arrivalRate}"
echo "Ramp Up Duration: ${rampUpDuration}"
echo ""
set -e
# Run the Artillery test locally
npx artillery run \
-e "${environment}" \
--env-file /workspaces/eps-load-test/runtimeenv.env \
--output /workspaces/eps-load-test/cpsu_load_test.json \
/workspaces/eps-load-test/artillery/cpsu_load_test.yml
# Generate a report from the test results
npx artillery report cpsu_load_test.json