-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sbom): fix wrong overwriting of applications obtained from differ…
…ent sbom files but having same app type (#8052)
- Loading branch information
1 parent
5e68bdc
commit fd07074
Showing
2 changed files
with
39 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,34 @@ func Test_sbomAnalyzer_Analyze(t *testing.T) { | |
want: &analyzer.AnalysisResult{ | ||
Applications: []types.Application{ | ||
{ | ||
Type: types.Jar, | ||
Type: types.Bitnami, | ||
FilePath: "opt/bitnami/elasticsearch", | ||
Packages: types.Packages{ | ||
{ | ||
ID: "[email protected]", | ||
Name: "elasticsearch", | ||
Version: "8.9.1", | ||
Arch: "arm64", | ||
Licenses: []string{"Elastic-2.0"}, | ||
Identifier: types.PkgIdentifier{ | ||
PURL: &packageurl.PackageURL{ | ||
Type: packageurl.TypeBitnami, | ||
Name: "elasticsearch", | ||
Version: "8.9.1", | ||
Qualifiers: packageurl.Qualifiers{ | ||
{ | ||
Key: "arch", | ||
Value: "arm64", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
Type: types.Jar, | ||
FilePath: "opt/bitnami/elasticsearch/.spdx-elasticsearch.spdx", | ||
Packages: types.Packages{ | ||
{ | ||
ID: "co.elastic.apm:apm-agent:1.36.0", | ||
|
@@ -88,32 +115,6 @@ func Test_sbomAnalyzer_Analyze(t *testing.T) { | |
}, | ||
}, | ||
}, | ||
{ | ||
Type: types.Bitnami, | ||
FilePath: "opt/bitnami/elasticsearch", | ||
Packages: types.Packages{ | ||
{ | ||
ID: "[email protected]", | ||
Name: "elasticsearch", | ||
Version: "8.9.1", | ||
Arch: "arm64", | ||
Licenses: []string{"Elastic-2.0"}, | ||
Identifier: types.PkgIdentifier{ | ||
PURL: &packageurl.PackageURL{ | ||
Type: packageurl.TypeBitnami, | ||
Name: "elasticsearch", | ||
Version: "8.9.1", | ||
Qualifiers: packageurl.Qualifiers{ | ||
{ | ||
Key: "arch", | ||
Value: "arm64", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
wantErr: require.NoError, | ||
|
@@ -125,7 +126,8 @@ func Test_sbomAnalyzer_Analyze(t *testing.T) { | |
want: &analyzer.AnalysisResult{ | ||
Applications: []types.Application{ | ||
{ | ||
Type: types.Jar, | ||
Type: types.Jar, | ||
FilePath: "opt/bitnami/elasticsearch/.spdx-elasticsearch.cdx", | ||
Packages: types.Packages{ | ||
{ | ||
FilePath: "opt/bitnami/elasticsearch/modules/apm/elastic-apm-agent-1.36.0.jar", | ||
|