修复 Rate Limit 集成测试的秒边界偶发失败
原测试仅发送2个请求,容易跨秒边界导致限流计数器重置, 偶发出现 200+200 而非期望的 200+429。 改为连续发送3个请求,只要第1个是200且后续至少1个是429即算通过, 消除秒边界抖动导致的假阴性。
This commit is contained in:
parent
e886ce104c
commit
32bd9a3a89
@ -849,11 +849,12 @@ for i in {1..30}; do
|
|||||||
done
|
done
|
||||||
rl_first=$(curl -s -o /dev/null -w "%{http_code}" "$BASE/")
|
rl_first=$(curl -s -o /dev/null -w "%{http_code}" "$BASE/")
|
||||||
rl_second=$(curl -s -o /dev/null -w "%{http_code}" "$BASE/")
|
rl_second=$(curl -s -o /dev/null -w "%{http_code}" "$BASE/")
|
||||||
if [[ "$rl_first" == "200" && "$rl_second" == "429" ]]; then
|
rl_third=$(curl -s -o /dev/null -w "%{http_code}" "$BASE/")
|
||||||
echo " ✓ Rate Limit 限流 — 第1次 200, 第2次 429"
|
if [[ "$rl_first" == "200" && ("$rl_second" == "429" || "$rl_third" == "429") ]]; then
|
||||||
|
echo " ✓ Rate Limit 限流 — 第1次 200, 后续请求中至少1次 429"
|
||||||
pass
|
pass
|
||||||
else
|
else
|
||||||
echo " ✗ Rate Limit 限流 — 期望 200+429, 实际 $rl_first+$rl_second"
|
echo " ✗ Rate Limit 限流 — 期望 200+429, 实际 $rl_first+$rl_second+$rl_third"
|
||||||
fail
|
fail
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user