mirror of
https://github.com/anchore/syft.git
synced 2026-10-30 14:02:26 +01:00
Enhance CPE generation for java GroupId and filtering (#402)
* enhance cpe generation for group id and filtering Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * rename group id const + add doc comment for HasAnyOfPrefixes Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
@@ -6,6 +6,7 @@ type testCase struct {
|
||||
name string
|
||||
pkgType pkg.Type
|
||||
pkgLanguage pkg.Language
|
||||
duplicates int
|
||||
pkgInfo map[string]string
|
||||
}
|
||||
|
||||
@@ -155,7 +156,6 @@ var commonTestCases = []testCase{
|
||||
pkgLanguage: pkg.Java,
|
||||
pkgInfo: map[string]string{
|
||||
"example-java-app-maven": "0.1.0",
|
||||
"example-jenkins-plugin": "1.0-SNAPSHOT", // the jenkins HPI file has a nested JAR of the same name
|
||||
"joda-time": "2.9.2",
|
||||
},
|
||||
},
|
||||
@@ -163,6 +163,7 @@ var commonTestCases = []testCase{
|
||||
name: "find jenkins plugins",
|
||||
pkgType: pkg.JenkinsPluginPkg,
|
||||
pkgLanguage: pkg.Java,
|
||||
duplicates: 1, // there is a "example-jenkins-plugin" HPI, and nested within that a JAR of the same name
|
||||
pkgInfo: map[string]string{
|
||||
"example-jenkins-plugin": "1.0-SNAPSHOT",
|
||||
},
|
||||
|
||||
@@ -96,7 +96,7 @@ func TestPkgCoverageImage(t *testing.T) {
|
||||
pkgCount++
|
||||
}
|
||||
|
||||
if pkgCount != len(c.pkgInfo) {
|
||||
if pkgCount != len(c.pkgInfo)+c.duplicates {
|
||||
t.Logf("Discovered packages of type %+v", c.pkgType)
|
||||
for a := range catalog.Enumerate(c.pkgType) {
|
||||
t.Log(" ", a)
|
||||
@@ -175,7 +175,7 @@ func TestPkgCoverageDirectory(t *testing.T) {
|
||||
actualPkgCount++
|
||||
}
|
||||
|
||||
if actualPkgCount != len(test.pkgInfo) {
|
||||
if actualPkgCount != len(test.pkgInfo)+test.duplicates {
|
||||
for actualPkg := range catalog.Enumerate(test.pkgType) {
|
||||
t.Log(" ", actualPkg)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user