Repository navigation
Migrate tests to JUnit Jupiter and bring them under the CI time budget - #19
Merged
Merged
Conversation
Replace the main-based fixtures (FixtureExec, FixtureSteps and per-class check helpers) with JUnit Jupiter 6.1.3, AssertJ, Awaitility and Testcontainers, all versioned in the catalog, and split each module into a `test` suite of pure unit tests and an `integrationTest` suite for the native bundle, packaged JARs, Docker and external tools, routed by tag: - host-native tests run in the test JVM on a Linux host, or through the JUnit Console Launcher in a pinned Corretto container of each selected C library (the default off Linux), with every JAR flat on `-cp lib/*` - privileged-container tests replace the agent's Python smoke, shutdown and interruption scripts with Testcontainers classes that run the packaged agent and correlator end to end against the host kernel - packaged-jar tests run against the shaded JAR alone; the scale test runs in a JVM of its own under the heap cap it proves Scale the slow scenarios down: the scale test drops from 2M rows and 158 s to 60k rows, 200 real distinct stacks and about 9 s (full size behind -PscaleRows/-PscaleHeap), and the degradation ladder runs on 10k rows through a new Limits.watermarkRows (hidden --watermark-rows) with a budget measured from the fixture. Fixtures are made deterministic: the fixture's frames stay interpreted, each test class gets a fresh JVM, and JFR's stack depth covers the scale test's recursion. CI runs the end-to-end tests inside `check` (musl jobs in container mode) instead of a separate smoke step. CODING.md documents the code and test conventions and is linked from AGENTS.md and README.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
CI's "Build and run checks" step spent most of its time in one fixture:
StreamingCorrelatorTest.scaletook 158 s ofa 200 s class on both architectures. The tests also ran on a homegrown main-based framework (
FixtureExec,FixtureSteps, copiedcheckhelpers), and the agent's end-to-end checks were Python scripts outside Gradle.What changes
Test framework. JUnit Jupiter 6.1.3, AssertJ 3.27.7, Awaitility 4.3.0 and the Testcontainers 2.0.5 BOM, versioned
in the catalog and wired through
jonoffcpu.java-conventions. Every fixture is now a JUnit test, with table-drivencases as
@ParameterizedTest, the end-to-end classes as@ParameterizedClassover the selected C libraries, and everywait bounded through Awaitility.
Unit and integration suites.
src/testholds pure unit tests that run anywhere with a JDK;src/integrationTestholds the rest, routed by tag:
host-nativeintegrationTeston a Linux host with a selected libc, orcontainerIntegrationTest<Platform>: the JUnit Console Launcher in the pinned Corretto image of each selected libc, all JARs flat on-cp lib/*(default off Linux, so macOS works; CI's musl jobs use it)privileged-containerintegrationTest, through Testcontainers: packaged smoke, shutdown, abrupt exit and async-profiler-first-stop, replacing the fourjonoffcpu-agent/tools/run-*.pyscriptspackaged-jarpackagedJarTest, against the shaded JAR alonescalescaleTest, in a JVM capped at the heap it provesTime budget.
-PscaleRows=2000000 -PscaleHeap=1g.Limits.watermarkRows, with a hidden--watermark-rowsoption; the default stays 65,536.checkof every module (all tasks rerun) takes about 70 s locally, for glibc and for musl in container mode.Deterministic fixtures. The scale test's old "≥ 100 distinct stacks" floor was only met through JIT variants: the
real fan-out was 64, JFR's default stack depth. Now:
CI. The end-to-end tests run inside
check, so the separate Python smoke step is gone.Docs. New
CODING.mdwith the code and test conventions, linked fromAGENTS.mdandREADME.md. The agent READMEand
OFFLINE.mdare updated.Verification
./gradlew :jonoffcpu-agent:check :jonoffcpu-correlator:check :jonoffcpu-jfr-converter:check --rerun-taskspasseson x86-64 with
-PnativeLibcs=glibc, and with-PnativeLibcs=musl -PintegrationTestsInContainer=true.check.spotlessCheckis clean.FixtureAcceptanceTestagainst realrecordings.