Skip to content

[improve][test] Reduce overlapping TestNG fixtures - #26562

Open
lhotari wants to merge 1 commit into
apache:masterfrom
lhotari:lh-improve-test-fixture-memory
Open

[improve][test] Reduce overlapping TestNG fixtures#26562
lhotari wants to merge 1 commit into
apache:masterfrom
lhotari:lh-improve-test-fixture-memory

Conversation

@lhotari

@lhotari lhotari commented Sep 12, 2026

Copy link
Copy Markdown
Member

Motivation

TestNG's default API ordering can interleave methods from different classes. Class-scoped broker fixtures then remain live together until their respective last methods finish, adding avoidable memory pressure within a test worker.

Modifications

Preserve class order and group factory-created instances in the shared TestNG configuration. This lets class and instance fixtures finish before the next group starts. Both options are needed because class ordering alone can interleave different instances of a factory-created test class. Gradle's test-fork parallelism and heap limits are unchanged.

Related fixture-isolation cleanup: #26563.

Verifying this change

  • Make sure that the change passes the CI checks.

  • assemble spotlessCheck checkstyleMain checkstyleTest passed.

  • All seven LoadBalancerTest tests and four invocations of the selected KeySharedSubscriptionTest methods passed with retries disabled.

  • Standalone lifecycle probes using TestNG 7.12.0 passed: the two-class probe reduced peak active fixtures from two to one; the factory probe retained one active fixture with both settings enabled. Each probe covered all of its four or six methods, respectively.

  • help and the selected tests ran successfully with configuration caching enabled.

  • Independent local review found no remaining issues.

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 — TestNG class/instance ordering
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Preserve class order and group factory instances so test fixtures can finish and release resources promptly within each worker.

Assisted-by: Codex

@void-ptr974 void-ptr974 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.

LGTM

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