8000 LoggingDistTest.httpAccessLogNotNamedPattern is not stable by namanONcode · Pull Request #45943 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

LoggingDistTest.httpAccessLogNotNamedPattern is not stable - #45943

Merged
ahus1 merged 1 commit into
keycloak:mainfrom
namanONcode:Issue-45522
Feb 3, 2026
Merged

ahus1 merged 1 commit into
keycloak:mainfrom
namanONcode:Issue-45522

Conversation

@namanONcode
@namanONcode namanONcode commented Feb 2, 2026 •
Copy link
Copy Markdown
Contributor

Issue: The LoggingDistTest.httpAccessLogNotNamedPattern test has been failing intermittently due to a race condition.

Closes #45522

Root Cause: When the test makes an HTTP request and immediately asserts on the log output, there's a timing window where the async log reader thread hasn't yet captured the access log message. The CLIResult.getOutput() returns the current state of the output buffer, which may not include the log entry yet.

Fix: Use Awaitility.await().atMost(5, TimeUnit.SECONDS).untilAsserted() to poll for log messages instead of immediate assertions. This pattern:

Polls repeatedly until the assertion passes or timeout is reached
Is already used in other similar tests like JaxRsDistTest.requestFilterTest
Properly handles the asynchronous nature of log capture
Changes:

Added Awaitility import to
LoggingDistTest.java
Wrapped log assertions in
httpAccessLogNotNamedPattern
with Awaitility polling
Applied the same fix to
testLogMdcShowingInTheLogs
which had the same potential issue
Renamed reassigned cliResult to fileCliResult to make the original effectively final for lambda usage
Testing
mvn test -Dtest=LoggingDistTest#httpAccessLogNotNamedPattern - PASSED
mvn test -Dtest=LoggingDistTest#testLogMdcShowingInTheLogs - PASSED
mvn spotless:check - PASSED

@namanONcode
namanONcode requested review from a team as code owners February 2, 2026 18:03
Copilot AI review requested due to automatic review settings February 2, 2026 18:03
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ahus1 ahus1 changed the title LoggingDistTest.httpAccessLogNotNamedPattern is not stable #45522 LoggingDistTest.httpAccessLogNotNamedPattern is not stable Feb 2, 2026
…nous log messages.

Signed-off-by: NAMAN JAIN <naman.049259@tmu.ac.in>
@ahus1
ahus1 enabled auto-merge (squash) February 3, 2026 08:02
@ahus1
ahus1 merged commit cfa1ed8 into keycloak:main Feb 3, 2026
86 checks passed
@namanONcode
namanONcode deleted the Issue-45522 branch March 7, 2026 06:24
@namanONcode
namanONcode restored the Issue-45522 branch March 7, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LoggingDistTest.httpAccessLogNotNamedPattern is not stable

3 participants

0