Skip to content

Commit ee1a7bf

Browse files
committed
tweak: wait for health check
1 parent 67def54 commit ee1a7bf

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

benchmark/load/run.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ function message() {
66
echo "$(date +"%T"): $1"
77
}
88

9+
function healthcheck() {
10+
local url=$1
11+
12+
while true; do
13+
if [[ $(curl -fso /dev/null -w "%{http_code}" "${url}") = 200 ]]; then
14+
break
15+
fi
16+
done
17+
}
18+
919
type=$1
1020

1121
if [ -n "$CI_JOB_TOKEN" ]; then
@@ -44,6 +54,17 @@ for app in *; do
4454

4555
for i in $(seq 1 $REPETITIONS_COUNT); do
4656
bash -c "${UTILS_DIR}/../${type}/${app}/start-servers.sh" &
57+
58+
if [ "${app}" == "petclinic" ]; then
59+
for port in $(seq 8080 8085); do
60+
healthcheck http://localhost:$port
61+
done
62+
elif [ "${app}" == "insecure-bank" ]; then
63+
for port in $(seq 8080 8088); do
64+
healthcheck http://localhost:$port/login
65+
done
66+
fi
67+
4768
(
4869
cd ${app} &&
4970
bash -c "${CPU_AFFINITY_K6}${UTILS_DIR}/run-k6-load-test.sh ${HEALTHCHECK_URL} 'pkill java'"

0 commit comments

Comments
 (0)