diff --git a/grype/pkg/package_test.go b/grype/pkg/package_test.go index 25d6309a543e..ed28a6dc02ae 100644 --- a/grype/pkg/package_test.go +++ b/grype/pkg/package_test.go @@ -431,6 +431,61 @@ func TestNew(t *testing.T) { }, }, }, + { + name: "nix-store-metadata", + syftPkg: syftPkg.Package{ + MetadataType: syftPkg.NixStoreMetadataType, + Metadata: syftPkg.NixStoreMetadata{ + OutputHash: "a", + Output: "a", + Files: []string{ + "a", + }, + }, + }, + }, + { + name: "linux-kernel-metadata", + syftPkg: syftPkg.Package{ + MetadataType: syftPkg.LinuxKernelMetadataType, + Metadata: syftPkg.LinuxKernelMetadata{ + Name: "a", + Architecture: "a", + Version: "a", + ExtendedVersion: "a", + BuildTime: "a", + Author: "a", + Format: "a", + RWRootFS: true, + SwapDevice: 10, + RootDevice: 11, + VideoMode: "a", + }, + }, + }, + { + name: "linux-kernel-module-metadata", + syftPkg: syftPkg.Package{ + MetadataType: syftPkg.LinuxKernelModuleMetadataType, + Metadata: syftPkg.LinuxKernelModuleMetadata{ + Name: "a", + Version: "a", + SourceVersion: "a", + Path: "a", + Description: "a", + Author: "a", + License: "a", + KernelVersion: "a", + VersionMagic: "a", + Parameters: map[string]syftPkg.LinuxKernelModuleParameter{ + "a": { + Type: "a", + Description: "a", + }, + }, + }, + }, + }, } // capture each observed metadata type, we should see all of them relate to what syft provides by the end of testing diff --git a/grype/pkg/provider_test.go b/grype/pkg/provider_test.go index b2954cecd3a3..a9aaf1f18998 100644 --- a/grype/pkg/provider_test.go +++ b/grype/pkg/provider_test.go @@ -160,12 +160,9 @@ func Test_filterPackageExclusions(t *testing.T) { for _, pkg := range test.locations { locations := source.NewLocationSet() for _, l := range pkg { - locations.Add(source.Location{ - Coordinates: source.Coordinates{ - RealPath: l, - }, - VirtualPath: l, - }) + locations.Add( + source.NewVirtualLocation(l, l), + ) } packages = append(packages, Package{Locations: locations}) } @@ -224,13 +221,7 @@ func Test_matchesLocation(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - matches, err := locationMatches(source.Location{ - Coordinates: source.Coordinates{ - RealPath: test.realPath, - }, - VirtualPath: test.virtualPath, - }, test.match) - + matches, err := locationMatches(source.NewVirtualLocation(test.realPath, test.virtualPath), test.match) assert.NoError(t, err) assert.Equal(t, test.expected, matches) }) diff --git a/grype/presenter/sarif/presenter_test.go b/grype/presenter/sarif/presenter_test.go index 1c4d72456030..a83fbc7c1e8c 100644 --- a/grype/presenter/sarif/presenter_test.go +++ b/grype/presenter/sarif/presenter_test.go @@ -163,12 +163,7 @@ func Test_locationPath(t *testing.T) { path := pres.packagePath(pkg.Package{ Locations: source.NewLocationSet( - source.Location{ - Coordinates: source.Coordinates{ - RealPath: test.real, - }, - VirtualPath: test.virtual, - }, + source.NewVirtualLocation(test.real, test.virtual), ), }) diff --git a/test/integration/compare_sbom_input_vs_lib_test.go b/test/integration/compare_sbom_input_vs_lib_test.go index 12599cea1cc0..6e33170e4b0d 100644 --- a/test/integration/compare_sbom_input_vs_lib_test.go +++ b/test/integration/compare_sbom_input_vs_lib_test.go @@ -71,8 +71,8 @@ func TestCompareSBOMInputToLibResults(t *testing.T) { string(syftPkg.CocoapodsPkg), string(syftPkg.HackagePkg), string(syftPkg.JenkinsPluginPkg), // package type cannot be inferred for all formats - string(syftPkg.Elixir), - string(syftPkg.Erlang), + string(syftPkg.LinuxKernelPkg), + string(syftPkg.LinuxKernelModulePkg), ) observedPkgTypes := strset.New()