Skip to content

fix: optimize test suite performance (2m42s → ~50s)#2527

Merged
maxandersen merged 4 commits into
mainfrom
fix/test-suite-performance
Jun 10, 2026
Merged

fix: optimize test suite performance (2m42s → ~50s)#2527
maxandersen merged 4 commits into
mainfrom
fix/test-suite-performance

Conversation

@maxandersen

Copy link
Copy Markdown
Collaborator

Test Suite Performance Optimization

Three independent improvements that reduce the test suite wall time from 2m 42s to ~50s (3.2x faster).

Commits

  1. fix: make askInput timeout configurable to avoid 60s test delay

    • Two tests (testHelloWorldGAVWithNoMain, testHelloWorldGAVWithModulesButNoManifest) blocked 30s each waiting on interactive Util.askInput() timeout
    • Added Util.getAskInputTimeout()/setAskInputTimeout() following existing static field pattern
    • BaseTest.initEnv() sets timeout to 0 so tests fail immediately instead of waiting
  2. test: replace Thread.sleep(1100) with file backdating in TestUtilDownloads

    • Thread.sleep(1100) waited for filesystem timestamp granularity for cache-evict checks
    • Replaced with Files.setLastModifiedTime() to backdate cached files by 2 seconds
  3. build: enable parallel test execution

    • Uncommented maxParallelForks = availableProcessors/2 in build.gradle
    • Each fork runs in a separate JVM with its own WireMock and mavenTempDir — no concurrency issues

Results

Metric Before After Improvement
Full test suite 2m 42s ~50s 🟢 3.2x faster
Two timeout tests 60s wasted 0.6s 60s saved
TestUtilDownloads 6.9s sleeping 0.1s 6.3s saved
Parallelism 1 fork 7 forks ~2x wall time reduction

Two tests (testHelloWorldGAVWithNoMain, testHelloWorldGAVWithModulesButNoManifest)
blocked for 30 seconds each waiting on Util.askInput() interactive timeout.

Add Util.getAskInputTimeout()/setAskInputTimeout() following the existing static
field pattern (setQuiet, setOffline, etc.) and set timeout to 0 in BaseTest.initEnv().

Reduces test suite from ~2m42s to ~1m45s (35% faster).
…loads

The 6 sleep calls waited for filesystem timestamp granularity so cache-evict
checks would see files as stale. Instead, backdate the cached file's
last-modified time by 2 seconds using Files.setLastModifiedTime().

Reduces TestUtilDownloads from ~6.9s to ~0.6s.
Uncomment maxParallelForks = availableProcessors/2 in build.gradle.
Each fork runs in a separate JVM with its own WireMock and mavenTempDir,
so there are no concurrency issues.

Reduces test suite wall time from ~1m40s to ~50s on a 14-core machine.
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • ai-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a4e93a8d-6a20-41a1-888e-ed6feb3b6e48

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@maxandersen maxandersen requested a review from quintesse June 10, 2026 22:27

@quintesse quintesse 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

@maxandersen maxandersen merged commit 947d3e7 into main Jun 10, 2026
30 checks passed
@maxandersen maxandersen deleted the fix/test-suite-performance branch June 10, 2026 23:05
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