|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | + |
| 4 | +if [ -z "${environment}" ]; then |
| 5 | + echo "environment is unset or set to the empty string" |
| 6 | + exit 1 |
| 7 | +fi |
| 8 | + |
| 9 | +if [ -z "${maxVusers}" ]; then |
| 10 | + echo "maxVusers is unset or set to the empty string" |
| 11 | + exit 1 |
| 12 | +fi |
| 13 | + |
| 14 | +if [ -z "${duration}" ]; then |
| 15 | + echo "duration is unset or set to the empty string" |
| 16 | + exit 1 |
| 17 | +fi |
| 18 | + |
| 19 | +if [ -z "${arrivalRate}" ]; then |
| 20 | + echo "arrivalRate is unset or set to the empty string" |
| 21 | + exit 1 |
| 22 | +fi |
| 23 | + |
| 24 | +if [ -z "${rampUpDuration}" ]; then |
| 25 | + echo "rampUpDuration is unset or set to the empty string" |
| 26 | + exit 1 |
| 27 | +fi |
| 28 | + |
| 29 | +if [ -z "${psu_api_key}" ]; then |
| 30 | + echo "psu_api_key is unset or set to the empty string" |
| 31 | + exit 1 |
| 32 | +fi |
| 33 | + |
| 34 | +if [ -z "${psu_private_key}" ]; then |
| 35 | + echo "psu_private_key is unset or set to the empty string" |
| 36 | + exit 1 |
| 37 | +fi |
| 38 | + |
| 39 | +if [ -z "${psu_kid}" ]; then |
| 40 | + echo "psu_kid is unset or set to the empty string" |
| 41 | + exit 1 |
| 42 | +fi |
| 43 | + |
| 44 | + |
| 45 | +# Create a dotenv file with the variables for Artillery |
| 46 | +cat <<EOF > runtimeenv.env |
| 47 | +maxVusers=${maxVusers} |
| 48 | +duration=${duration} |
| 49 | +arrivalRate=${arrivalRate} |
| 50 | +rampUpDuration=${rampUpDuration} |
| 51 | +psu_api_key="${psu_api_key}" |
| 52 | +psu_private_key="${psu_private_key}" |
| 53 | +psu_kid="${psu_kid}" |
| 54 | +EOF |
| 55 | + |
| 56 | +echo "Running Artillery test locally..." |
| 57 | +echo "" |
| 58 | +echo "Max Virtual Users: ${maxVusers}" |
| 59 | +echo "Phase Duration: ${duration}" |
| 60 | +echo "Arrival Rate: ${arrivalRate}" |
| 61 | +echo "Ramp Up Duration: ${rampUpDuration}" |
| 62 | +echo "" |
| 63 | + |
| 64 | +set -e |
| 65 | + |
| 66 | +# Run the Artillery test locally |
| 67 | +npx artillery run \ |
| 68 | + -e "${environment}" \ |
| 69 | + --dotenv /workspaces/eps-load-test/runtimeenv.env \ |
| 70 | + --output /workspaces/eps-load-test/notify_load_test.json \ |
| 71 | + /workspaces/eps-load-test/artillery/notify_load_test.yml |
| 72 | + |
| 73 | +# Generate a report from the test results |
| 74 | +npx /workspaces/eps-load-test/artillery report notify_load_test.json |
0 commit comments