Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit43f26df

Browse files
authored
feat(scaletest/templates): run all scenarios even on failure (#10290)
We now also end all failed phases and add the `error` tag in Grafana.
1 parent9a0aac8 commit43f26df

File tree

3 files changed

+49
-8
lines changed

3 files changed

+49
-8
lines changed

‎.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ jobs:
223223
go-version:1.20.10
224224

225225
-name:Install shfmt
226-
run:go install mvdan.cc/sh/v3/cmd/shfmt@v3.5.0
226+
run:go install mvdan.cc/sh/v3/cmd/shfmt@v3.7.0
227227

228228
-name:make fmt
229229
run:|

‎scaletest/templates/scaletest-runner/scripts/lib.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ end_phase() {
8787
log"End phase${phase_num}:${phase}"
8888
echo"$(date -Ins) END:${phase_num}:${phase}">>"${SCALETEST_PHASE_FILE}"
8989

90-
GRAFANA_EXTRA_TAGS="${PHASE_TYPE:-phase-default}" annotate_grafana_end"phase""Phase${phase_num}:${phase}"
90+
GRAFANA_EXTRA_TAGS="${PHASE_TYPE:-phase-default}"GRAFANA_ADD_TAGS="${PHASE_ADD_TAGS:-}"annotate_grafana_end"phase""Phase${phase_num}:${phase}"
9191
}
9292
get_phase() {
9393
if [[-f"${SCALETEST_PHASE_FILE}" ]];then
@@ -183,11 +183,20 @@ annotate_grafana_end() {
183183

184184
log"Annotating Grafana (end=${end}):${text} [${tags}]"
185185

186-
json="$(
187-
jq \
188-
--argjson timeEnd"${end}" \
189-
'{timeEnd: $timeEnd}'<<<'{}'
190-
)"
186+
if [[-n${GRAFANA_ADD_TAGS:-} ]];then
187+
json="$(
188+
jq -n \
189+
--argjson timeEnd"${end}" \
190+
--argjson tags"${tags},${GRAFANA_ADD_TAGS}" \
191+
'{timeEnd: $timeEnd, tags: $tags | split(",")}'
192+
)"
193+
else
194+
json="$(
195+
jq -n \
196+
--argjson timeEnd"${end}" \
197+
'{timeEnd: $timeEnd}'
198+
)"
199+
fi
191200
if [[${DRY_RUN}== 1 ]];then
192201
log"Would have patched Grafana annotation: id=${id}, data=${json}"
193202
return 0

‎scaletest/templates/scaletest-runner/scripts/run.sh

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@ end_phase
2626

2727
wait_baseline"${SCALETEST_PARAM_LOAD_SCENARIO_BASELINE_DURATION}"
2828

29+
declare -A failed=()
2930
forscenarioin"${SCALETEST_PARAM_LOAD_SCENARIOS[@]}";do
3031
start_phase"Load scenario:${scenario}"
32+
33+
set +e
34+
status=0
3135
case"${scenario}"in
3236
"SSH Traffic")
3337
coder exp scaletest workspace-traffic \
@@ -37,6 +41,7 @@ for scenario in "${SCALETEST_PARAM_LOAD_SCENARIOS[@]}"; do
3741
--timeout"${SCALETEST_PARAM_LOAD_SCENARIO_SSH_TRAFFIC_DURATION}m" \
3842
--job-timeout"${SCALETEST_PARAM_LOAD_SCENARIO_SSH_TRAFFIC_DURATION}m30s" \
3943
--output json:"${SCALETEST_RESULTS_DIR}/traffic-ssh.json"
44+
status=$?
4045
show_json"${SCALETEST_RESULTS_DIR}/traffic-ssh.json"
4146
;;
4247
"Web Terminal Traffic")
@@ -46,6 +51,7 @@ for scenario in "${SCALETEST_PARAM_LOAD_SCENARIOS[@]}"; do
4651
--timeout"${SCALETEST_PARAM_LOAD_SCENARIO_WEB_TERMINAL_TRAFFIC_DURATION}m" \
4752
--job-timeout"${SCALETEST_PARAM_LOAD_SCENARIO_WEB_TERMINAL_TRAFFIC_DURATION}m30s" \
4853
--output json:"${SCALETEST_RESULTS_DIR}/traffic-web-terminal.json"
54+
status=$?
4955
show_json"${SCALETEST_RESULTS_DIR}/traffic-web-terminal.json"
5056
;;
5157
"Dashboard Traffic")
@@ -54,13 +60,39 @@ for scenario in "${SCALETEST_PARAM_LOAD_SCENARIOS[@]}"; do
5460
--job-timeout"${SCALETEST_PARAM_LOAD_SCENARIO_DASHBOARD_TRAFFIC_DURATION}m30s" \
5561
--output json:"${SCALETEST_RESULTS_DIR}/traffic-dashboard.json" \
5662
>"${SCALETEST_RESULTS_DIR}/traffic-dashboard-output.log"
63+
status=$?
5764
show_json"${SCALETEST_RESULTS_DIR}/traffic-dashboard.json"
5865
;;
66+
67+
# Debug scenarios, for testing the runner.
68+
"debug:success")
69+
maybedryrun"$DRY_RUN" sleep 10
70+
status=0
71+
;;
72+
"debug:error")
73+
maybedryrun"$DRY_RUN" sleep 10
74+
status=1
75+
;;
5976
esac
60-
end_phase
77+
set -e
78+
if((status>0));then
79+
log"Load scenario failed:${scenario} (exit=${status})"
80+
failed+=(["${scenario}"]="$status")
81+
PHASE_ADD_TAGS=error end_phase
82+
else
83+
end_phase
84+
fi
6185

6286
wait_baseline"${SCALETEST_PARAM_LOAD_SCENARIO_BASELINE_DURATION}"
6387
done
6488

89+
if((${#failed[@]}>0));then
90+
log"Load scenarios failed:${!failed[*]}"
91+
forscenarioin"${!failed[@]}";do
92+
log"${scenario}: exit=${failed[$scenario]}"
93+
done
94+
exit 1
95+
fi
96+
6597
log"Scaletest complete!"
6698
set_status Complete

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp