-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Replace fixed delay with polling in SyslogAppenderCustomLayoutTest
#3944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
...j-core-test/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTestBase.java
Outdated
Show resolved
Hide resolved
SyslogAppenderCustomLayoutTest
|
@Kcruz28, thanks for the fix. Would you mind signing your commits, please? If you need guidance for that, ChatGPT responds well to the following prompt:
|
|
I see that CI has failed due to styling issues. Please make sure to run |
The test was failing intermittently due to a race condition in the test's base class, . This commit replaces the fixed with a more robust polling mechanism using the library to ensure the test is stable and reliable.
ec38498 to
2b5f65b
Compare
|
I’ve signed my commits, and I believe I’ve fixed the styling issues. Please let me know if you encounter any problems. |
This PR fixes a flaky test that was failing because of a race condition.
This pull request addresses intermittent test failures caused by relying on a fixed delay
Thread.sleep()to wait for asynchronous operations. Fixed delays are unreliable because the operation may occasionally take longer than the predefined wait time.This commit replaces the fixed delay with a polling mechanism using the Awaitility library. Awaitility continuously checks for the expected condition within a specified timeout, ensuring the test only proceeds once the desired state is reached. This makes the test more robust and reliable by synchronizing with actual operation completion rather than arbitrary timing.
Fixes #3006
Important
Base your changes on
2.xbranch if you are targeting Log4j 2; usemainotherwise.Checklist
Before we can review and merge your changes, please go through the checklist below. If you're still working on some items, feel free to submit your pull request as a draft—our CI will help guide you through the remaining steps.
✅ Required checks
License: I confirm that my changes are submitted under the Apache License, Version 2.0.
Commit signatures: All commits are signed and verifiable. (See GitHub Docs on Commit Signature Verification).
Code formatting: The code is formatted according to the project’s style guide.
How to check and fix formatting
./mvnw spotless:check./mvnw spotless:applySee the build instructions for details.
Build & Test: I verified that the project builds and all unit tests pass.
How to build the project
Run:
./mvnw verifySee the build instructions for details.
🧪 Tests (select one)
📝 Changelog (select one)
src/changelog/.2.x.x. (See Changelog Entry File Guide).