11#! /usr/bin/env bash
22
3-
4- if [ -z " ${artillery_key} " ]; then
5- echo " artillery_key is unset or set to the empty string. Get one from here: https://app.artillery.io/"
6- exit 1
7- fi
8-
3+ # Required checks
94if [ -z " ${environment} " ]; then
105 echo " environment is unset or set to the empty string"
116 exit 1
@@ -21,6 +16,11 @@ if [ -z "${duration}" ]; then
2116 exit 1
2217fi
2318
19+ if [ -z " ${rampUpDuration} " ]; then
20+ echo " rampUpDuration is unset or set to the empty string"
21+ exit 1
22+ fi
23+
2424if [ -z " ${arrivalRate} " ]; then
2525 echo " arrivalRate is unset or set to the empty string"
2626 exit 1
@@ -41,12 +41,20 @@ if [ -z "${psu_kid}" ]; then
4141 exit 1
4242fi
4343
44+ # Check artillery_key but don't fail — just omit recording if absent
45+ if [ -z " ${artillery_key} " ]; then
46+ echo " Warning: artillery_key is unset; running test without recording to Artillery Cloud."
47+ RECORD_ARGS=" "
48+ else
49+ RECORD_ARGS=" --record --key ${artillery_key} "
50+ fi
4451
4552# Create a dotenv file with the variables for Artillery
4653cat << EOF > runtimeenv.env
4754maxVusers=${maxVusers}
4855duration=${duration}
4956arrivalRate=${arrivalRate}
57+ rampUpDuration=${rampUpDuration}
5058psu_api_key="${psu_api_key} "
5159psu_private_key="${psu_private_key} "
5260psu_kid="${psu_kid} "
@@ -58,15 +66,17 @@ echo ""
5866echo " Environment: ${environment} "
5967echo " Max Virtual Users: ${maxVusers} "
6068echo " Run Phase Duration: ${duration} "
69+ echo " Ramp-up Duration: ${rampUpDuration} "
6170echo " Arrival Rate: ${arrivalRate} "
71+ [ -n " ${artillery_key} " ] && echo " Recording to Artillery Cloud with key: ${artillery_key} "
6272echo " "
6373
6474set -e
6575
66- # Run the Artillery test locally
76+ # Run the Artillery test locally, conditionally including recording flags
6777npx artillery run \
6878 -e " ${environment} " \
69- --env-file /workspaces/eps-load-test/ runtimeenv.env \
70- --output /workspaces/eps-load-test/ notify_load_test.json \
71- --record --key ${artillery_key} \
72- /workspaces/eps-load-test/ artillery/notify_load_test.yml
79+ --env-file " $( pwd ) / runtimeenv.env" \
80+ --output " $( pwd ) / notify_load_test.json" \
81+ $RECORD_ARGS \
82+ " $( pwd ) / artillery/notify_load_test.yml"
0 commit comments