Skip to content

[fix][test] Fix flaky SaslAuthenticateTest.testMaxInflightContext() test#25948

Merged
merlimat merged 2 commits into
apache:masterfrom
oneby-wang:fix-sasl-max-inflight-flaky-test
Jun 6, 2026
Merged

[fix][test] Fix flaky SaslAuthenticateTest.testMaxInflightContext() test#25948
merlimat merged 2 commits into
apache:masterfrom
oneby-wang:fix-sasl-max-inflight-flaky-test

Conversation

@oneby-wang

Copy link
Copy Markdown
Contributor

Fixes #25941

Motivation

SaslAuthenticateTest.testMaxInflightContext() is flaky because Caffeine may perform size-based eviction asynchronously. The test asserted the cache size immediately after inserting inflight SASL contexts, so it could observe entries before Caffeine maintenance reduced the cache to the configured maximum.

Modifications

  • Added package-private test accessors for the SASL authentication state cache.
  • Forced Caffeine maintenance with cleanUp() before asserting the configured max inflight SASL context size.
  • Added a regression test that delays Caffeine maintenance to cover the flaky window before verifying cleanUp() applies the configured maximum.
  • Replaced SASL header, state, and token string literals in the affected tests with SaslConstants constants.

Verifying this change

  • Make sure that the change passes the CI checks.

Does this pull request potentially affect one of the following parts:

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

@oneby-wang

Copy link
Copy Markdown
Contributor Author

/pulsarbot rerun-failure-checks

@merlimat merlimat merged commit 1414387 into apache:master Jun 6, 2026
44 of 46 checks passed
@lhotari lhotari added this to the 5.0.0-M1 milestone Jun 12, 2026
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.

Flaky-test: SaslAuthenticateTest.testMaxInflightContext

3 participants