CI's PR policy failed on scripts/check-testing-short.sh. The check is an
allowlist keyed on file::function, and the sweeper slice (519fb1479) deleted
cmd/bd/prune_bench_test.go, moving that budget into internal/workapi as
TestCandidateIDMatcherLargeFixture — the same skip, in the package the matcher
moved to, renamed for what it now measures. The allowlist entry became stale in
the same commit that created its replacement.
This is a RENAME of the existing exception, not a new one: the old entry is
removed, so the count of approved testing.Short() sites is unchanged and a
genuinely new skip still has to be argued for.
Also two stale counts, both the same accumulation this series has been prone
to — a wave adds a role and updates the prose in one place but not the other:
- cmd/bd/serve.go said "the two issue roles" in two places, above a struct
that now carries thirteen.
- internal/httpapi/roles_test.go had THREE separate cases each introducing
itself as "the newest role" (querier, sweeper, ready counter). At most one
can be, and none of them is after wave 4. The general point those comments
were each restating — that the case which matters is the newest role
missing, because that is what a caller written against the previous release
passes — is stated once on the test's doc comment now, so each row keeps
only what is specific to it.
56 lines
1.7 KiB
Bash
Executable file
56 lines
1.7 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Ensure testing.Short() is only used for true runtime/stress/large-fixture skips.
|
|
|
|
set -euo pipefail
|
|
|
|
allowed=$(
|
|
cat <<'EOF'
|
|
internal/hooks/hooks_test.go::TestRunSync_Timeout
|
|
internal/hooks/hooks_test.go::TestRunSync_KillsDescendants
|
|
internal/testutil/fixtures/fixtures_test.go::TestXLargeDolt
|
|
internal/testutil/fixtures/fixtures_test.go::TestLargeFromJSONL
|
|
internal/storage/dolt/concurrent_test.go::TestHighContentionStress
|
|
internal/storage/dolt/concurrent_test.go::TestConcurrentWorkQueueDrain
|
|
internal/storage/dolt/lease_test.go::TestConcurrentHeartbeatReclaimClose
|
|
internal/storage/uow/lostupdate_dolt_test.go::TestUOW_ConcurrentMergeOps_NoLostUpdate
|
|
internal/workapi/sweep_test.go::TestCandidateIDMatcherLargeFixture
|
|
EOF
|
|
)
|
|
|
|
status=0
|
|
|
|
while IFS=: read -r file line _; do
|
|
file="${file#./}"
|
|
if [[ -z "$file" || -z "$line" ]]; then
|
|
continue
|
|
fi
|
|
|
|
func=$(
|
|
awk -v target="$line" '
|
|
NR <= target && /^func [A-Za-z0-9_]+\(/ {
|
|
current = $0
|
|
sub(/^func /, "", current)
|
|
sub(/\(.*/, "", current)
|
|
}
|
|
END { print current }
|
|
' "$file"
|
|
)
|
|
key="${file}::${func}"
|
|
|
|
if ! grep -Fxq "$key" <<<"$allowed"; then
|
|
printf 'Disallowed testing.Short() at %s:%s in %s\n' "$file" "$line" "${func:-unknown}" >&2
|
|
status=1
|
|
fi
|
|
done < <(find . -type f -name '*.go' -not -path './.git/*' -exec grep -n 'testing\.Short()' {} + || true)
|
|
|
|
if (( status != 0 )); then
|
|
cat >&2 <<'EOF'
|
|
|
|
testing.Short() is reserved for true runtime, stress, or large-fixture skips.
|
|
Use build tags, environment checks, or named wrappers for integration/e2e/API
|
|
boundaries instead.
|
|
EOF
|
|
exit "$status"
|
|
fi
|
|
|
|
printf 'testing.Short() usage is limited to approved runtime/stress/large-fixture skips.\n'
|