test: cover persistence failover and graceful draining

Add API integration checks, migration compatibility, rolling restart scenarios and a report verification collector.
This commit is contained in:
2026-10-29 11:47:46 +03:00
parent 676b38c18b
commit 5c8bcf0f80
37 changed files with 5538 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
#!/bin/sh
# A barrier makes sequential probes fail: all four requests must start together.
set -eu
sed '/^check_ready &/,$d' /source/start-nginx.sh > /tmp/readiness-under-test.sh
. /tmp/readiness-under-test.sh
mkdir -p /tmp/readiness-barrier
cycle=0
getent() {
for ip in 1 2 3 4; do printf '192.0.2.%s STREAM api\n' "$ip"; done
}
wget() {
for arg do
case "$arg" in http://*) address=${arg#http://}; address=${address%%:*} ;; esac
done
touch "/tmp/readiness-barrier/$address"
attempt=0
while [ "$attempt" -lt 50 ]; do
if [ "$(find /tmp/readiness-barrier -type f | wc -l)" -eq 4 ]; then return 0; fi
attempt=$((attempt + 1))
command sleep 0.01
done
return 1
}
nginx() { return 0; }
sleep() {
if [ "$cycle" -eq 2 ]; then
count=$(grep -c 'server 192.0.2.' "$upstreams" || true)
[ "$count" -eq 4 ] || { printf 'FAIL: readiness probes did not start in parallel\n'; exit 1; }
printf 'PASS: four concurrent probes admitted after two successful rounds\n'
exit 0
fi
rm -f /tmp/readiness-barrier/*
cycle=$((cycle + 1))
}
check_ready