test(detectors): fixture-based graph tests for gomod, gradle, maven, syft#181
Conversation
These four detectors had no committed-fixture tests for their graph
builders. Add testdata fixtures + tests that drive the parsers directly,
with no dependency on the go / gradle / mvn / syft tooling:
- gomod: testdata/demo/{go.mod, go-list-deps.json} → parseGoModFile +
depGraphFromGoList (package set, transitive edges, runtime vs test-only
development scope).
- maven: testdata/dependency-tree.tgf → depGraphFromMavenTGF (edges,
compile→runtime / test→development scope).
- gradle: testdata/dependencies.txt → depGraphFromGradleOutput
(runtimeClasspath vs testRuntimeClasspath scope).
- syft: graphFromSyftSBOM mapping test built from a hand-constructed Syft
SBOM struct (the builtin path consumes a library struct, not a text
manifest); asserts package→node, dependency-of→edge, license carry-through.
The other detectors (nuget + cargo/pub/ruby/conan/cocoapods/githubactions)
already drive ResolveGraph against testdata/project fixtures via their
committed-lock fast-paths, so no redundant tests were added there.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (4)
📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds four new fixture-driven test files for the ChangesDetector fixture test suites
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Bomly Diff SummaryCompared Overview
Dependency Changes✅ No dependency changes. Vulnerabilities✅ No vulnerability changes. License Changes✅ No license changes. Project Posture✅ No project posture changes (or Policy Findings✅ No policy differences were identified. |
What
Adds committed-fixture tests for the four detectors whose graph builders had no testdata-fixture coverage — following the pattern established by the node and python
lockfile_integration_test.go. No test invokes a build tool: each drives the parser entrypoint directly against a committed fixture.testdata/demo/{go.mod, go-list-deps.json}parseGoModFile+depGraphFromGoListtestdata/dependency-tree.tgfdepGraphFromMavenTGFcompile→runtime /test→development scopetestdata/dependencies.txtdepGraphFromGradleOutputruntimeClasspathvstestRuntimeClasspathscopesyft/sbom.SBOMstructgraphFromSyftSBOMdependency-of→edge, license carry-throughgomod/gradle/mavenResolveGraphshells out to the toolchain, so the tests call the lower-leveldepGraphFrom*parsers with captured output. The syft builtin path consumes the Syft library's SBOM struct rather than a text manifest, so its fixture is the struct itself (behind the same!bomly_external_syftbuild tag); it invokes nosyftbinary.Why only these four
While scoping this I found the rest of the detector suite already has testdata-fixture tests:
nuget,cargo,pub,ruby,conan,cocoapods, andgithubactionseach driveResolveGraphagainst atestdata/project/directory via their committed-lock fast-paths (e.g.nuget'sTestDetectorResolveGraphFromFixtureProject,cargo'sDetector{WorkingDir:"testdata/project"}). Those are already build-tool-free, so adding more there would be redundant. The genuine gap was the four detectors above.Notes
internal/detectors/sbomtests already write SBOM docs tot.TempDir()and exerciseinternal/sbom; committed SBOM fixtures there are a possible future nicety but not a coverage gap.🤖 Generated with Claude Code
Summary by CodeRabbit
Tests