Skip to content
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

Reduce runtime of long-running S2S unit tests (and fix OF-2942 as a byproduct) #2644

Merged
merged 7 commits into from
Jan 4, 2025

Conversation

guusdk
Copy link
Member

@guusdk guusdk commented Jan 3, 2025

The unit tests that verify s2s behavior take a long time to execute. The changes in this PR reduce that time (significantly).

This is mostly achieved by changes to the test code. Also, one improvement in Openfire itself is provided: it no longer waits for a timeout on certain irrecoverable outbound s2s failures (OF-2942).

@guusdk guusdk force-pushed the tests-improve-speed branch 2 times, most recently from 65bc760 to df53aea Compare January 4, 2025 13:08
@guusdk guusdk marked this pull request as draft January 4, 2025 15:27
@guusdk guusdk force-pushed the tests-improve-speed branch 2 times, most recently from aa53f85 to 5fef848 Compare January 4, 2025 17:51
@guusdk guusdk changed the title Tests improve speed Reduce runtime of long-running S2S unit tests (and fix OF-2942 as a byproduct) Jan 4, 2025
guusdk added 7 commits January 4, 2025 19:12
No functional changes to the unit tests, but adds a simple mechanism to record how much time passed between logged statements.
By properly detecting a stream error, the test needs not to wait for proper session teardown.
This test uses an older SocketAcceptor, that cannot be interrupted. This means that we wait until SO_TIMEOUT before the test ends.

This commit reduces the SO_TIMEOUT value. This runs the risk of introducing instability.
This test uses an older SocketAcceptor, that cannot be interrupted. This means that we wait until SO_TIMEOUT before the test ends.

This commit reduces the SO_TIMEOUT value. This runs the risk of introducing instability.
…nTest

Both tests use a ServerSocket that is 'slow' to shut down. By explicitly closing it, it shuts down faster, improving the duration of the test fixture teardown.
The test teardown waits for inbound stream IDs to be registered with the session manager. Many streams (those that have errored out or have been replaced with an encrypted stream) won't ever be registered in the Session Manager. The test teardown doesn't need to wait for those.

This commit introduces a change that tracks the streams that are still in-flight. Test teardown will now only wait for those.
Abort outbound server-to-server attempts immediately (rather than waiting for a timeout), when:
- the remote peer requires encryption, but the local server cannot do encryption
- authentication mechanisms are exhausted (eg: no client cert for EXTERNAL, and Dialback unavailable)
@guusdk guusdk force-pushed the tests-improve-speed branch from 5fef848 to a340aa9 Compare January 4, 2025 18:12
@guusdk guusdk marked this pull request as ready for review January 4, 2025 18:13
@akrherz akrherz merged commit 92cd5c5 into igniterealtime:main Jan 4, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants