syft/syft/pkg/cataloger/snap/parse_integration_test.go
Alan Pope 0bca34f986
fix: snap cataloger incorrectly identifies snap container as deb package (#4500)
Signed-off-by: Alan Pope <alan@popey.com>
Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
Co-authored-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
2026-01-30 10:19:26 -05:00

48 lines
1.4 KiB
Go

package snap
import (
"testing"
"github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/pkg/cataloger/internal/pkgtest"
)
func TestParseSystemManifest(t *testing.T) {
fixture := "test-fixtures/manifest.yaml"
locations := file.NewLocationSet(file.NewLocation(fixture))
expected := []pkg.Package{
{
Name: "grub-efi-amd64-signed",
Version: "1.202+2.12-1ubuntu7",
Type: pkg.DebPkg,
PURL: "pkg:deb/ubuntu/grub-efi-amd64-signed@1.202%2B2.12-1ubuntu7?arch=amd64", // URL encoded
Locations: locations,
Metadata: pkg.SnapEntry{
SnapType: pkg.SnapTypeApp, // Default type when gadget not detected from name
Base: "core24",
SnapName: "pc",
SnapVersion: "24-0.1",
Architecture: "amd64", // From architectures array
},
},
{
Name: "shim-signed",
Version: "1.56+15.7-0ubuntu1",
Type: pkg.DebPkg,
PURL: "pkg:deb/ubuntu/shim-signed@1.56%2B15.7-0ubuntu1?arch=amd64", // URL encoded
Locations: locations,
Metadata: pkg.SnapEntry{
SnapType: pkg.SnapTypeApp, // Default type when gadget not detected from name
Base: "core24",
SnapName: "pc",
SnapVersion: "24-0.1",
Architecture: "amd64", // From architectures array
},
},
}
pkgtest.TestFileParser(t, fixture, parseSystemManifest, expected, nil)
}