Fix unstable testPostBrokerLoginFlowWithOTP_bruteForceEnabled test

Closes #33549

Signed-off-by: Martin Kanis <mkanis@redhat.com>
This commit is contained in:
Martin Kanis 2024-10-11 14:36:26 +02:00 committed by Pedro Igor
parent 8fb5ecaa6c
commit a8a5c96510

View file

@ -199,7 +199,7 @@ public class AssertEvents implements TestRule {
public ExpectedEvent expectRegister(String username, String email) {
return expectRegister(username, email, DEFAULT_CLIENT_ID);
}
public ExpectedEvent expectRegister(String username, String email, String clientId) {
UserRepresentation user = username != null ? getUser(username) : null;
return expect(EventType.REGISTER)
@ -399,13 +399,12 @@ public class AssertEvents implements TestRule {
List<String> presentedEventTypes = new LinkedList<>();
for (int i = 0 ; i < 25 ; i++) {
EventRepresentation event = fetchNextEvent(seconds);
if (event == null) {
Assert.fail("Did not find the event of expected type " + expected.getType() +". Events present: " + presentedEventTypes);
}
if (expected.getType().equals(event.getType())) {
return assertEvent(event);
} else {
presentedEventTypes.add(event.getType());
if (event != null) {
if (expected.getType().equals(event.getType())) {
return assertEvent(event);
} else {
presentedEventTypes.add(event.getType());
}
}
}
Assert.fail("Did not find the event of expected type " + expected.getType() +". Events present: " + presentedEventTypes);