Skip to content

Commit abce36d

Browse files
authored
[CI] Improve running FTR tests by avoiding rerunning a config when agent is lost (reapplied) (#238631)
## Summary Reapply @maryam-saeidi's #237705 + Adds a fix for when the scout reporter is not enabled
1 parent d20c9bf commit abce36d

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

.buildkite/scripts/steps/test/ftr_configs.sh

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,16 @@ while read -r config; do
5353
fi
5454

5555
FULL_COMMAND="node scripts/functional_tests --bail --config $config $EXTRA_ARGS"
56-
echo "--- $ $FULL_COMMAND"
56+
57+
CONFIG_EXECUTION_KEY="${config}_executed"
58+
IS_CONFIG_EXECUTION=$(buildkite-agent meta-data get "$CONFIG_EXECUTION_KEY" --default "false" --log-level error)
59+
60+
if [[ "${IS_CONFIG_EXECUTION}" == "true" ]]; then
61+
echo "--- [ already-tested ] $FULL_COMMAND"
62+
continue
63+
else
64+
echo "--- $ $FULL_COMMAND"
65+
fi
5766

5867
start=$(date +%s)
5968

@@ -80,6 +89,17 @@ while read -r config; do
8089
lastCode=$?
8190
set -e;
8291

92+
# Scout reporter
93+
if [[ "${SCOUT_REPORTER_ENABLED:-}" =~ ^(1|true)$ ]]; then
94+
# Upload events after running each config
95+
echo "Upload Scout reporter events to AppEx QA's team cluster for config $config"
96+
node scripts/scout upload-events --dontFailOnError
97+
echo "Upload successful, removing local events at .scout/reports"
98+
rm -rf .scout/reports
99+
else
100+
echo "SCOUT_REPORTER_ENABLED=$SCOUT_REPORTER_ENABLED, skipping event upload."
101+
fi
102+
83103
timeSec=$(($(date +%s)-start))
84104
if [[ $timeSec -gt 60 ]]; then
85105
min=$((timeSec/60))
@@ -93,7 +113,10 @@ while read -r config; do
93113
duration: ${duration}
94114
result: ${lastCode}")
95115

96-
if [ $lastCode -ne 0 ]; then
116+
if [ $lastCode -eq 0 ]; then
117+
# Test was successful, so mark it as executed
118+
buildkite-agent meta-data set "$CONFIG_EXECUTION_KEY" "true"
119+
else
97120
exitCode=10
98121
echo "FTR exited with code $lastCode"
99122
echo "^^^ +++"
@@ -114,7 +137,4 @@ echo "--- FTR configs complete"
114137
printf "%s\n" "${results[@]}"
115138
echo ""
116139

117-
# Scout reporter
118-
source .buildkite/scripts/steps/test/scout_upload_report_events.sh
119-
120140
exit $exitCode

0 commit comments

Comments
 (0)