test: add E2E test for openSUSE Leap ecosystem mapping - #2937
Conversation
Adds a pinned opensuse/leap:15.5 image fixture and scan-image test cases (plain + JSON format), following the same pattern used for the AlmaLinux (google#2870) and Mageia (google#2873) ecosystem E2E tests. Depends on the openSUSE Leap ecosystem mapping fix that just merged in google/osv-scalibr#2290 (closes google/osv-scalibr#2203).
…ckages The image scan's default "artifact" preset wired up apk, dpkg, chisel, and homebrew, but never the rpm extractor, so RPM-based images (AlmaLinux, RHEL, Rocky, Mageia, openSUSE Leap, ...) produced zero inventory. This is the same root cause already fixed for AlmaLinux in PR google#2870 (f995ea5), which hasn't landed on main yet; registering it here so the new openSUSE Leap E2E test (and RPM-based scanning in general) actually detects packages instead of failing with "No package sources found". Also points go.mod at a branch of the osv-scalibr fork carrying just the openSUSE Leap ecosystem mapping fix (google/osv-scalibr#2290) cherry-picked onto the same osv-scalibr version already used by the AlmaLinux/Mageia branches, since bumping straight to the latest osv-scalibr main pulls in unrelated breaking API changes. Same temporary-replace pattern used while google#2250 was in flight; drop once osv-scanner's own osv-scalibr bump catches up. Updates snapshots/cassettes across scan/image, scan/source, output, and scalibrplugin affected by rpm now being a registered extractor.
|
Hi @Ly-Joey , |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2937 +/- ##
==========================================
+ Coverage 79.29% 79.31% +0.02%
==========================================
Files 118 118
Lines 8080 8080
==========================================
+ Hits 6407 6409 +2
+ Misses 1314 1313 -1
+ Partials 359 358 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
osv-scalibr's os/rpm extractor has a Windows-only stub (rpm_dummy.go, //go:build windows) whose FileRequired() always returns false, so no RPM packages are ever detected there. This is upstream/pre-existing and affects any RPM-based image test on windows-latest, not something introduced by this PR (the same failure mode hits the AlmaLinux google#2870 and Mageia google#2873 E2E PRs for the same reason).
|
Pushed a fix for the Windows failure (d2add0f). Root cause: it's not stdout/stderr mixing or gRPC transport noise, it's that This isn't something this PR introduced: the AlmaLinux (#2870) and Mageia (#2873) E2E PRs fail Rather than skipping OCI image tests broadly on non-Linux (which would drop coverage for the chisel/apk/homebrew image tests that already pass fine on Windows/macOS), I scoped the skip to just the openSUSE Leap RPM subtests on Windows, following the existing if runtime.GOOS == "windows" && strings.Contains(strings.ToLower(tt.Name), "opensuse") {
testutility.Skip(t, "Skipping RPM-based test as os/rpm extraction is not supported on Windows")
}Verified locally: build is clean, and both openSUSE Leap subtests pass in |
|
Thanks, I'll merge this tomorrow after the release. |
|
Thanks, appreciate it! Looking forward to it. |
Summary
Adds an end-to-end test for the openSUSE Leap ecosystem mapping fix that just merged in google/osv-scalibr#2290 (closes google/osv-scalibr#2203), following the same pattern used for the AlmaLinux (#2870) and Mageia (#2873) ecosystem E2E tests.
opensuse/leap:15.5image fixture (test-opensuse-leap-15.5.Dockerfile).Scanning_openSUSE_Leap_15.5_image/scanning_opensuse_leap_15.5_imagecases toTestCommand_OCIImageandTestCommand_OCIImage_JSONFormat, with recorded cassette entries and snapshots showing real SUSE-SU advisories detected forcurlandopenssl-1_1.While wiring this up I found the
os/rpmextractor was never registered in theartifactpreset used by image scanning (internal/scalibrplugin/presets.go), so any RPM-based image, not just openSUSE Leap, currently scans with zero package inventory ("No package sources found"). This is the same root cause already fixed for AlmaLinux in #2870 (commit f995ea5), which hasn't landed onmainyet, so I included the same registration here to unblock this test. Updated the snapshots/cassettes it touches (scan/source,internal/output,internal/scalibrplugin).go.modpoints at a branch on my osv-scalibr fork carrying just the openSUSE Leap ecosystem fix cherry-picked onto the same osv-scalibr base already used by the AlmaLinux/Mageia branches. Bumping straight to the latest osv-scalibrmainpulls in unrelated breaking API changes (PluginConfigrefactor, Maven client signature changes, etc.) that osv-scanner hasn't absorbed yet. This is the same temporary-replace pattern used while #2250 was in flight; happy to drop it once either this or the AlmaLinux/Mageia scalibr bump lands.Test plan
go build ./...: cleango test ./... -short: all packages passTEST_ACCEPTANCE=true go test ./cmd/osv-scanner/scan/image/... -run 'TestCommand_OCIImage$|TestCommand_OCIImage_JSONFormat$': all pass, including the new openSUSE Leap casescurl 8.0.1-150400.5.50.1matchesSUSE-SU-2024:3926-1andSUSE-SU-2024:4359-1;openssl-1_1 1.1.1l-150500.17.34.1matchesSUSE-SU-2024:3765-1; ecosystemopenSUSE:Leap 15.5; base imageopensuse/leapcorrectly detected.cc @Ly-Joey: this follows up on your review request on google/osv-scalibr#2290 to add E2E coverage for the openSUSE Leap ecosystem mapping.