Skip to content

Commit a0af2fd

Browse files
committed
test(e2e): hold the postgres and bucket walkthrough waits to the floor
The postgres backup walkthrough's HelmRelease waits and every table walkthrough's bucket wait now clear the install-timeout floor, and the Chainsaw ops grew to contain them, but nothing checked it: a wait dropped back under the floor, or raised without its op, would pass. The op check cannot catch the bucket case on its own, since a lower wait only widens the slack. Add postgres to the table the other walkthroughs are held by, with the remainder its op kept through the raise, and hold each table suite's bucket wait to the bucket release's floor, read from the api-server default with bucket-rd checked for an override. This holds the budgets only; what a CNPG first boot costs on this platform is still unmeasured. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent 4386014 commit a0af2fd

1 file changed

Lines changed: 55 additions & 3 deletions

File tree

‎hack/mariadb-first-boot-waits.bats‎

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ MBW_START_MARGIN=60
9797
MBW_SUITES='mariadb|"mariadb-|packages/apps/mariadb/templates/mariadb.yaml|900
9898
mongodb|"$MONGODB_|-|1200
9999
rabbitmq|"$RABBITMQ_|-|900
100-
clickhouse|"clickhouse-|-|2700'
100+
clickhouse|"clickhouse-|-|2700
101+
postgres|"postgres-|-|1980'
101102

102103
# Print one "<release-arg> <timeout>" line per wait_hr_ready call in $1 whose
103104
# release argument starts with $2, compared as a literal string, or every call
@@ -1238,6 +1239,16 @@ an op with no timeout was not refused: '${mbw_got}'" ;; esac
12381239
[ -z "$mbw_err" ] || { printf '%s\n' "$mbw_err" >&2; exit 1; }
12391240
}
12401241

1242+
@test "the postgres walkthrough's database waits clear the floor by the start margin" {
1243+
mbw_err=$(mbw_suite_floor_errors postgres)
1244+
[ -z "$mbw_err" ] || { printf '%s\n' "$mbw_err" >&2; exit 1; }
1245+
}
1246+
1247+
@test "the postgres round-trip op keeps its slack once the waits it reaches are paid" {
1248+
mbw_err=$(mbw_suite_slack_errors postgres)
1249+
[ -z "$mbw_err" ] || { printf '%s\n' "$mbw_err" >&2; exit 1; }
1250+
}
1251+
12411252
@test "the rabbitmq walkthrough's database waits clear the floor by the start margin" {
12421253
mbw_err=$(mbw_suite_floor_errors rabbitmq)
12431254
[ -z "$mbw_err" ] || { printf '%s\n' "$mbw_err" >&2; exit 1; }
@@ -1258,6 +1269,47 @@ an op with no timeout was not refused: '${mbw_got}'" ;; esac
12581269
[ -z "$mbw_err" ] || { printf '%s\n' "$mbw_err" >&2; exit 1; }
12591270
}
12601271

1272+
@test "every table walkthrough's bucket wait clears the floor by the start margin" {
1273+
# The floor check above holds the database waits only, so a floor failure
1274+
# names one release. The bucket wait is held here instead, per suite, since
1275+
# an op check alone accepts a bucket wait that drops back: a lower wait only
1276+
# widens the slack. bucket-rd has to leave the floor at the server default.
1277+
mbw_rd=packages/system/bucket-rd/cozyrds/bucket.yaml
1278+
[ -f "$mbw_rd" ] || { echo "$mbw_rd not found, so the bucket floor cannot be checked against an override" >&2; exit 1; }
1279+
if grep -qE 'release.cozystack.io/helm-install-(timeout|disable-wait)' "$mbw_rd"; then
1280+
echo "$mbw_rd moves the install timeout or disables the wait; the bucket floor here assumes neither" >&2
1281+
exit 1
1282+
fi
1283+
mbw_install=$(mbw_install_timeout "$MBW_APISERVER")
1284+
mbw_fail=
1285+
for mbw_s in $(printf '%s\n' "$MBW_SUITES" | cut -d'|' -f1); do
1286+
mbw_b=
1287+
for mbw_f in "examples/backups/$mbw_s"/*.sh; do
1288+
mbw_b="$mbw_b$(mbw_db_waits "$mbw_f" '"bucket-')
1289+
"
1290+
done
1291+
mbw_n=$(printf '%s' "$mbw_b" | grep -c . || true)
1292+
if [ "$mbw_n" -ne 1 ]; then
1293+
mbw_fail="$mbw_fail
1294+
${mbw_s}: expected exactly 1 bucket HelmRelease wait, found ${mbw_n}"
1295+
continue
1296+
fi
1297+
mbw_t=$(printf '%s' "$mbw_b" | awk 'NF { print $NF }')
1298+
case "$mbw_t" in
1299+
''|*[!0-9]*)
1300+
mbw_fail="$mbw_fail
1301+
${mbw_s}: the bucket wait states no literal budget (got ${mbw_t})"
1302+
continue
1303+
;;
1304+
esac
1305+
if [ "$(mbw_wait_clears_floor "$mbw_t" "$mbw_install")" != "ok" ]; then
1306+
mbw_fail="$mbw_fail
1307+
${mbw_s}: the bucket wait allows ${mbw_t}s; the floor is the ${mbw_install}s release install timeout and a wait must exceed it by MBW_START_MARGIN=${MBW_START_MARGIN}s"
1308+
fi
1309+
done
1310+
[ -z "$mbw_fail" ] || { printf '%s\n' "$mbw_fail" >&2; exit 1; }
1311+
}
1312+
12611313
@test "the chainsaw suite's HelmRelease-ready asserts beat the same budget" {
12621314
# Same wait, same mechanism, different file. This assert is the first gate
12631315
# in each suite, so if it expires below a legal first boot the suite reds on
@@ -1388,8 +1440,8 @@ an op with no timeout was not refused: '${mbw_got}'" ;; esac
13881440
# bucket wait, as a ceiling the op has to contain. The reason is scope, not
13891441
# the floor: packages/system/bucket-rd sets neither helm-install-timeout
13901442
# nor helm-install-disable-wait, so the bucket release carries the same
1391-
# 600s floor, and its wait clears it. Keeping it out of the floor check
1392-
# keeps a floor failure naming one cause, the database release.
1443+
# 600s floor, and its wait clears it; a test of its own holds that, so a
1444+
# database floor failure keeps naming one cause.
13931445
mbw_all=$(mbw_all_waits "$MBW_SCRIPT")
13941446
printf '%s\n' "$mbw_all" | grep -q '^"bucket-' || {
13951447
echo "expected $MBW_SCRIPT to wait for a bucket release; the fixture this test reasons about is gone" >&2

0 commit comments

Comments
 (0)