From 245c05945842072c3c9eb927030bc9623a3a5d47 Mon Sep 17 00:00:00 2001 From: cschlaefke Date: Wed, 4 Nov 2026 11:07:02 +0100 Subject: [PATCH] fix(e2e): zweite-IP-Drosselungstest toleriert Nachfuellrate des Limiters 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 --- e2e/tests/throttle/krit07-drosselung.spec.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/e2e/tests/throttle/krit07-drosselung.spec.ts b/e2e/tests/throttle/krit07-drosselung.spec.ts index 0268eed..a3f89ee 100644 --- a/e2e/tests/throttle/krit07-drosselung.spec.ts +++ b/e2e/tests/throttle/krit07-drosselung.spec.ts @@ -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 () => { const { email, password } = await createUser(); const first = client(randomIp()); + const started = Date.now(); for (let attempt = 1; attempt <= authConfig.loginBurst; attempt++) { 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 wrong = await second.signIn(email, `${password}-falsch`);