-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_cpsu_load_test.sh
More file actions
executable file
·64 lines (52 loc) · 1.84 KB
/
run_cpsu_load_test.sh
File metadata and controls
executable file
·64 lines (52 loc) · 1.84 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
63
64
#!/usr/bin/env bash
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 "${environment}" ]; then
echo "environment 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 ! [[ "${environment}" =~ ^(dev|ref)$ ]]
then
echo "environment must be dev or ref"
exit 1
fi
security_group=$(aws cloudformation list-exports --output json | jq -r '.Exports[] | select(.Name == "artillery-resources:ArtillerySecurityGroupId") | .Value' | grep -o '[^:]*$')
export security_group
vpc_subnets=$(aws cloudformation list-exports --output json | jq -r '.Exports[] | select(.Name == "vpc-resources:PrivateSubnets") | .Value' | grep -o '[^:]*$')
export vpc_subnets
artillery_worker_role_name=$(aws cloudformation list-exports --output json | jq -r '.Exports[] | select(.Name == "artillery-resources:ArtilleryWorkerRoleName") | .Value' | grep -o '[^:]*$')
export artillery_worker_role_name
cat <<EOF > runtimeenv.env
maxVusers=$maxVusers
duration=$duration
arrivalRate=$arrivalRate
rampUpDuration=$rampUpDuration
EOF
echo ${launch_config}
# shellcheck disable=SC2090,SC2086
npx artillery run-fargate \
--environment "${environment}" \
--secret cpsu_api_key \
--region eu-west-2 \
--cluster artilleryio-cluster \
--security-group-ids "${security_group}" \
--subnet-ids "${vpc_subnets}" \
--task-role-name "${artillery_worker_role_name}" \
--env-file runtimeenv.env \
--output cpsu_load_test.json \
artillery/cpsu_load_test.yml
npx artillery report cpsu_load_test.json