fix(e2e): zweite-IP-Drosselungstest toleriert Nachfuellrate des Limiters
All checks were successful
CI / flutter (pull_request) Successful in 1m16s
CI / web-build (pull_request) Successful in 59s
CI / supabase (pull_request) Successful in 10s
CI / supabase-tests (pull_request) Successful in 36s
CI / e2e (pull_request) Successful in 2m54s

Laufzeit der 30 Versuche messen und bis zu refillTolerance(elapsed) weitere
Versuche zulassen, bis 429 kommt (wie im ersten Test der Datei).

Refs #65

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
cschlaefke 2026-11-04 11:07:02 +01:00
parent 19f2e676b0
commit 245c059458

View file

@ -78,10 +78,17 @@ test.describe('KTO-01 Kriterium 7: Drosselung der Anmeldung (throttle)', () => {
test('KTO-01 Kriterium 7: AUTH-CFG-10 eine zweite IP ist von der Drosselung der ersten nicht betroffen', async () => { test('KTO-01 Kriterium 7: AUTH-CFG-10 eine zweite IP ist von der Drosselung der ersten nicht betroffen', async () => {
const { email, password } = await createUser(); const { email, password } = await createUser();
const first = client(randomIp()); const first = client(randomIp());
const started = Date.now();
for (let attempt = 1; attempt <= authConfig.loginBurst; attempt++) { for (let attempt = 1; attempt <= authConfig.loginBurst; attempt++) {
await first.signIn(email, `${password}-falsch`); await first.signIn(email, `${password}-falsch`);
} }
expect((await first.signIn(email, `${password}-falsch`)).status).toBe(429); const tolerance = refillTolerance(Date.now() - started);
// Der Limiter fuellt 0,5 Token/s nach: bis zu `tolerance` weitere Versuche, bis die 429 kommt.
let limited = await first.signIn(email, `${password}-falsch`);
for (let extra = 0; extra < tolerance && limited.status !== 429; extra++) {
limited = await first.signIn(email, `${password}-falsch`);
}
expect(limited.status).toBe(429);
const second = client(randomIp()); const second = client(randomIp());
const wrong = await second.signIn(email, `${password}-falsch`); const wrong = await second.signIn(email, `${password}-falsch`);