Merge pull request 'fix(e2e): Throttle-Test „zweite IP“ toleriert Nachfüllrate' (#66) from fix/65-throttle-test-zweite-ip into main
Reviewed-on: #66
This commit is contained in:
commit
4f5e314b96
1 changed files with 8 additions and 1 deletions
|
|
@ -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`);
|
||||
|
|
|
|||
Loading…
Reference in a new issue