-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_load_test.sh
39 lines (29 loc) · 935 Bytes
/
run_load_test.sh
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
#!/bin/bash
source config.sh
mkdir -p "$RESULTS_DIR"
run_test() {
local users=$1
local timestamp=$(date +"%Y%m%d_%H%M%S")
local result_dir="${RESULTS_DIR}/${users}_users_${timestamp}"
mkdir -p "$result_dir"
echo "Starting main test for $users users"
locust -f "$LOCUST_FILE" --headless -u $users -r $((users/10)) -t "${TEST_DURATION}" \
--html "$result_dir/report.html" \
--csv "$result_dir/report"
echo "Test completed for $users users. Results saved in $result_dir"
}
cleanup() {
# Should clean up or restart docker container here
echo "Performing cleanup..."
}
for users in "${USER_COUNTS[@]}"
do
echo "Starting iteration for $users users"
run_test $users
if [ "$users" != "${USER_COUNTS[-1]}" ]; then
echo "Pausing for $PAUSE_TIME seconds to allow return to idle state"
sleep $PAUSE_TIME
fi
cleanup
done
echo "All tests completed."