OF-3119: Relax Happy Eyeballs unit test timing for MacOS#3205
Merged
guusdk merged 2 commits intoigniterealtime:mainfrom Mar 17, 2026
Merged
OF-3119: Relax Happy Eyeballs unit test timing for MacOS#3205guusdk merged 2 commits intoigniterealtime:mainfrom
guusdk merged 2 commits intoigniterealtime:mainfrom
Conversation
…chiverTest testArchiverInDistinctBatchesWhenOutsideGrace used Thread.sleep() to ensure the archiver had flushed the first item before submitting the second. This relied on the OS thread scheduler waking the archiver thread within the sleep window, which holds on Linux but not on macOS due to differences in thread scheduling behavior between the two platforms. Replace the sleep with the existing waitUntilArchivingIsDone() helper, which polls until the first item is confirmed stored before archiving the second. This makes the test deterministic regardless of platform or scheduler behavior.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to reduce unit test flakiness on macOS by relaxing/avoiding sleep-based timing assumptions that are sensitive to OS scheduling behavior.
Changes:
- Adjusts
HappyEyeballsResolverTesttiming by using a larger resolution delay on macOS. - Replaces a
Thread.sleep(...)synchronization inArchiverTestwith a helper that waits until archiving has completed.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
xmppserver/src/test/java/org/jivesoftware/openfire/net/HappyEyeballsResolverTest.java |
Makes the resolution delay OS-dependent to reduce macOS timing flakiness. |
xmppserver/src/test/java/org/jivesoftware/openfire/archive/ArchiverTest.java |
Avoids fixed sleeps by waiting for the archiver to finish storing expected data; updates copyright year. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
xmppserver/src/test/java/org/jivesoftware/openfire/net/HappyEyeballsResolverTest.java
Show resolved
Hide resolved
xmppserver/src/test/java/org/jivesoftware/openfire/net/HappyEyeballsResolverTest.java
Show resolved
Hide resolved
xmppserver/src/test/java/org/jivesoftware/openfire/archive/ArchiverTest.java
Show resolved
Hide resolved
xmppserver/src/test/java/org/jivesoftware/openfire/archive/ArchiverTest.java
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scheduling of Java processes apparently works differently on MacOS, causing tests that depend on sleep-based synchronization to frequently fail. In this PR, modifications have been made to reduce the impact of this (at the expense of granularity).