Skip to content

Commit

Permalink
additional test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Will Murphy <[email protected]>
  • Loading branch information
willmurphyscode committed Aug 18, 2023
1 parent 3ca436a commit 74e6851
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions grype/pkg/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,13 +706,34 @@ func Test_RemoveBinaryPackagesByOverlap(t *testing.T) {
[]string{"rpm:[email protected] -> apk:[email protected]"}),
expectedPackages: []string{"apk:[email protected]", "rpm:[email protected]"},
},
{
name: "does not exclude if OS package owns OS package",
sbom: catalogWithOverlaps(
[]string{"rpm:[email protected]", "rpm:[email protected]"},
[]string{"rpm:[email protected] -> rpm:[email protected]"}),
expectedPackages: []string{"apk:[email protected]", "rpm:[email protected]"},
},
{
name: "does not exclude if owning package is non-OS",
sbom: catalogWithOverlaps(
[]string{"python:[email protected]", "python:[email protected]"},
[]string{"python:[email protected] -> python:[email protected]"}),
expectedPackages: []string{"apk:[email protected]", "rpm:[email protected]"},
},
{
name: "python bindings for system RPM install",
sbom: withDistro(catalogWithOverlaps(
[]string{"rpm:[email protected]", "python:[email protected]"},
[]string{"rpm:[email protected] -> python:[email protected]"}), "rhel"),
expectedPackages: []string{"rpm:[email protected]"},
},
{
name: "amzn linux doesn't remove packages in this way",
sbom: withDistro(catalogWithOverlaps(
[]string{"rpm:[email protected]", "python:[email protected]"},
[]string{"rpm:[email protected] -> python:[email protected]"}), "amzn"),
expectedPackages: []string{"rpm:[email protected]", "python:[email protected]"},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
Expand Down

0 comments on commit 74e6851

Please sign in to comment.