Flaky test BruteForceTest.testPermanentLockout()

Closes #32498

Signed-off-by: Douglas Palmer <dpalmer@redhat.com>
This commit is contained in:
Douglas Palmer 2024-08-29 14:32:44 -07:00 committed by Alexander Schwartz
parent ecbd856176
commit 0b7ab47cf2

View file

@ -558,6 +558,7 @@ public class BruteForceTest extends AbstractTestRealmKeycloakTest {
try { try {
// arrange // arrange
realm.setPermanentLockout(true); realm.setPermanentLockout(true);
realm.setQuickLoginCheckMilliSeconds(0L);
testRealm().update(realm); testRealm().update(realm);
// act // act
@ -567,7 +568,7 @@ public class BruteForceTest extends AbstractTestRealmKeycloakTest {
// As of now, there are two events: USER_DISABLED_BY_PERMANENT_LOCKOUT and LOGIN_ERROR but Order is not // As of now, there are two events: USER_DISABLED_BY_PERMANENT_LOCKOUT and LOGIN_ERROR but Order is not
// guarantee though since the brute force detector is running separately "in its own thread" named // guarantee though since the brute force detector is running separately "in its own thread" named
// "Brute Force Protector". // "Brute Force Protector".
List<EventRepresentation> actualEvents = Arrays.asList(events.poll(), events.poll(), events.poll()); List<EventRepresentation> actualEvents = Arrays.asList(events.poll(), events.poll());
assertIsContained(events.expect(EventType.USER_DISABLED_BY_PERMANENT_LOCKOUT).client((String) null).detail(Details.REASON, "brute_force_attack detected"), actualEvents); assertIsContained(events.expect(EventType.USER_DISABLED_BY_PERMANENT_LOCKOUT).client((String) null).detail(Details.REASON, "brute_force_attack detected"), actualEvents);
assertIsContained(events.expect(EventType.LOGIN_ERROR).error(Errors.INVALID_USER_CREDENTIALS), actualEvents); assertIsContained(events.expect(EventType.LOGIN_ERROR).error(Errors.INVALID_USER_CREDENTIALS), actualEvents);