Repository navigation
Share test fixtures through java-test-fixtures and one capture codec module - #20
Merged
Merged
Conversation
…module Move everything the tests use but that is not a test into each module's `src/testFixtures`, with Gradle's java-test-fixtures plugin: fixture builders, JFR event types, the command-line and export helpers, and the workloads and checks that tests and proof tools launch. Helpers that other test classes called inside OfflineCorrelatorTest, CommandLineTest and ExportTest become CorrelationFixture, CommandLineFixture and ExportFixture. The fixture variants are never published. The capture stream's Java codec is now generated once, in a new unpublished jonoffcpu-capture-codec module that owns src/main/proto/jonoffcpu-capture.proto; the agent and the correlator embed it through embeddedRuntime and relocate its protobuf runtime as before, and the correlator generates only its own profile schema from src/main/proto. The fixture that encodes JSON rows as stream records, duplicated in both modules, is one CaptureRecordFixture in the codec module's test fixtures. The Rust collector and both native-bundle Dockerfiles read the schema from its new location, and the native build now lists it as an input. The plain JAR of a shaded module gets a `plain` classifier and declares its unrelocated libraries, so consumers inside the build no longer resolve the shaded JAR in its place; only external embedded libraries are checked against pinned digests. CODING.md documents the fixture conventions.
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
Test helpers lived inside test classes, so tests called into other test classes, the integration suite compiled against the unit tests' output, and the agent and the correlator each carried a copy of the fixture that encodes capture stream records. Each Java module also generated its own copy of the capture codec from
docs/schema.What changes
Test fixtures. Every module applies Gradle's
java-test-fixturesplugin throughjonoffcpu.java-conventions.src/testFixturesholds what the suites share:CorrelationFixture(fromOfflineCorrelatorTest),CommandLineFixture(fromCommandLineTest),ExportFixture(fromExportTest);*Workloadand*Checkmain classes the integration tests and proof tools launch, and the C helpers insrc/testFixtures/c.Fixtures may use AssertJ; the fixture variants are never published.
One capture codec. A new unpublished
jonoffcpu-capture-codecmodule ownssrc/main/proto/jonoffcpu-capture.protoand generates the Java codec once. The agent and the correlator embed it throughembeddedRuntimeand relocate its protobuf runtime as before; the correlator generates only its own profile schema, now injonoffcpu-correlator/src/main/proto. The duplicated JSON-row encoder is oneCaptureRecordFixturein the codec module's test fixtures, used throughtestFixtures(project(":jonoffcpu-capture-codec")). The Rust collector'sbuild.rsand both native-bundle Dockerfiles read the schema from its new location, and the native bundle build lists it as an input.Shaded modules. The plain JAR used to be disabled and shared the shaded JAR's file name, so any in-build consumer of the module's ordinary variant got the relocated JAR. It now has a
plainclassifier and declares its unrelocated libraries; it is not published. Only external embedded libraries are checked against pinned digests. CI's shaded-JAR selection skips*-test-fixtures.jar.Docs. CODING.md documents the fixture conventions; AGENTS.md, the READMEs and OFFLINE.md point at the new schema locations and module.
Verification
./gradlew checkpasses with the same test counts as before: agent 80 unit, packaged-JAR and the host-native container tests; correlator 183 unit, 19 integration, packaged-JAR and scale tests. A second run reuses the configuration cache.CaptureProtoonce with protobuf relocated; only the correlator's hasProfileProto. No publication references the codec module, fixtures or plain JARs.privileged-containerend-to-end tests ran only where CI has Linux.The proof tools under
jonoffcpu-native/tools/still reference amake all test-javastep andbuild/test-classes, which the Gradle build no longer has; only their C helper paths are updated here.