github.com/anchore/syft@v1.38.2/syft/pkg/cataloger/snap/parse_base_dpkg_test.go (about) 1 package snap 2 3 import ( 4 "testing" 5 6 "github.com/anchore/syft/syft/file" 7 "github.com/anchore/syft/syft/pkg" 8 "github.com/anchore/syft/syft/pkg/cataloger/internal/pkgtest" 9 ) 10 11 func TestParseBaseDpkgYaml(t *testing.T) { 12 fixture := "test-fixtures/dpkg.yaml" 13 locations := file.NewLocationSet(file.NewLocation(fixture)) 14 15 expected := []pkg.Package{ 16 { 17 Name: "adduser", 18 Version: "3.118ubuntu2", 19 Type: pkg.DebPkg, 20 PURL: "pkg:deb/ubuntu/adduser@3.118ubuntu2", 21 Locations: locations, 22 Metadata: pkg.SnapEntry{ 23 SnapType: pkg.SnapTypeBase, 24 }, 25 }, 26 { 27 Name: "apparmor", 28 Version: "2.13.3-7ubuntu5.3", 29 Type: pkg.DebPkg, 30 PURL: "pkg:deb/ubuntu/apparmor@2.13.3-7ubuntu5.3", 31 Locations: locations, 32 Metadata: pkg.SnapEntry{ 33 SnapType: pkg.SnapTypeBase, 34 }, 35 }, 36 { 37 Name: "gcc-10-base", 38 Version: "10.5.0-1ubuntu1~20.04", 39 Type: pkg.DebPkg, 40 PURL: "pkg:deb/ubuntu/gcc-10-base@10.5.0-1ubuntu1~20.04?arch=amd64", 41 Locations: locations, 42 Metadata: pkg.SnapEntry{ 43 SnapType: pkg.SnapTypeBase, 44 Architecture: "amd64", // from package name suffix 45 }, 46 }, 47 } 48 49 pkgtest.TestFileParser(t, fixture, parseBaseDpkgYaml, expected, nil) 50 }