Skip to content

[improve][test] Speed up HealthCheckTest by sharing cluster across test methods - #25448

Merged
merlimat merged 1 commit into
apache:masterfrom
merlimat:improve/speed-up-healthcheck-test
Mar 31, 2026
Merged

merlimat merged 1 commit into
apache:masterfrom
merlimat:improve/speed-up-healthcheck-test

Conversation

@merlimat

Copy link
Copy Markdown
Contributor

Summary

  • Switch HealthCheckTest from @BeforeMethod/@AfterMethod to @BeforeClass/@AfterClass so the Docker-based PulsarCluster is started once instead of once per test method
  • Add SIGCONT (pkill -CONT) in finally blocks for destructive tests (testZooKeeperDown, testBookKeeperDown) to resume stopped processes and keep the cluster usable
  • Properly override TestRetrySupport.setup()/cleanup() and remove unused imports/dead code

This reduces the test from ~5 minutes (3 full cluster start/stop cycles) to ~2 minutes (1 cycle).

Motivation

HealthCheckTest was one of the slowest integration tests. Each of its 3 test methods was spinning up an entire PulsarCluster (ZooKeeper + BookKeeper + Broker containers) and tearing it down, even though the tests themselves are trivial healthcheck CLI calls.

Documentation

  • doc-required

(If you update the description, also update the determine of the documentation)

  • doc-not-needed
    (Please explain why)

  • doc (Your PR doesn't need any doc update)

Matching PR in forked repository

PR in forked repository:


  • ready-to-test

area/test

…st methods

HealthCheckTest was starting and stopping an entire Docker-based
PulsarCluster (ZK + BookKeeper + Broker) for each of its 3 test methods
via @BeforeMethod/@AfterMethod, taking ~5 minutes total.

Switch to @BeforeClass/@afterclass so the cluster is created once and
shared across all tests. The destructive tests (testZooKeeperDown,
testBookKeeperDown) now resume stopped processes with SIGCONT in finally
blocks, keeping the cluster usable for subsequent tests.

Also properly override TestRetrySupport's setup()/cleanup() methods and
remove unused imports and dead code.
@github-actions github-actions Bot added the doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. label Mar 31, 2026
@merlimat
merlimat merged commit c971581 into apache:master Mar 31, 2026
80 of 84 checks passed
@merlimat
merlimat deleted the improve/speed-up-healthcheck-test branch March 31, 2026 21:24
@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

area/test doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. ready-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants