diff --git a/pkg/fanal/artifact/image/image_test.go b/pkg/fanal/artifact/image/image_test.go index 517b42877189..fbcddef9ce4a 100644 --- a/pkg/fanal/artifact/image/image_test.go +++ b/pkg/fanal/artifact/image/image_test.go @@ -909,6 +909,113 @@ func TestArtifact_Inspect(t *testing.T) { Type: "bundler", FilePath: "ruby-app/Gemfile.lock", Packages: types.Packages{ + { + ID: "dotenv@2.7.2", + Name: "dotenv", + Version: "2.7.2", + Indirect: false, + Relationship: types.RelationshipDirect, + DependsOn: []string(nil), + Locations: []types.Location{ + { + StartLine: 51, + EndLine: 51, + }, + }, + }, + { + ID: "faker@1.9.3", + Name: "faker", + Version: "1.9.3", + Indirect: false, + Relationship: types.RelationshipDirect, + DependsOn: []string{"i18n@1.6.0"}, + Locations: []types.Location{ + { + StartLine: 53, + EndLine: 53, + }, + }, + }, + { + ID: "json@2.2.0", + Name: "json", + Version: "2.2.0", + Indirect: false, + Relationship: types.RelationshipDirect, + DependsOn: []string(nil), + Locations: []types.Location{ + { + StartLine: 60, + EndLine: 60, + }, + }, + }, + { + ID: "pry@0.12.2", + Name: "pry", + Version: "0.12.2", + Indirect: false, + Relationship: types.RelationshipDirect, + DependsOn: []string{ + "coderay@1.1.2", + "method_source@0.9.2", + }, + Locations: []types.Location{ + { + StartLine: 79, + EndLine: 79, + }, + }, + }, + { + ID: "rails@5.2.0", + Name: "rails", + Version: "5.2.0", + Indirect: false, + Relationship: types.RelationshipDirect, + DependsOn: []string{ + "actioncable@5.2.3", + "actionmailer@5.2.3", + "actionpack@5.2.3", + "actionview@5.2.3", + "activejob@5.2.3", + "activemodel@5.2.3", + "activerecord@5.2.3", + "activestorage@5.2.3", + "activesupport@5.2.3", + "railties@5.2.3", + "sprockets-rails@3.2.1", + }, + Locations: []types.Location{ + { + StartLine: 86, + EndLine: 86, + }, + }, + }, + { + ID: "rubocop@0.67.2", + Name: "rubocop", + Version: "0.67.2", + Indirect: false, + Relationship: types.RelationshipDirect, + DependsOn: []string{ + "jaro_winkler@1.5.2", + "parallel@1.17.0", + "parser@2.6.3.0", + "psych@3.1.0", + "rainbow@3.0.0", + "ruby-progressbar@1.10.0", + "unicode-display_width@1.5.0", + }, + Locations: []types.Location{ + { + StartLine: 112, + EndLine: 112, + }, + }, + }, { ID: "actioncable@5.2.3", Name: "actioncable", @@ -1158,20 +1265,6 @@ func TestArtifact_Inspect(t *testing.T) { }, }, }, - { - ID: "dotenv@2.7.2", - Name: "dotenv", - Version: "2.7.2", - Indirect: false, - Relationship: types.RelationshipDirect, - DependsOn: []string(nil), - Locations: []types.Location{ - { - StartLine: 51, - EndLine: 51, - }, - }, - }, { ID: "erubi@1.8.0", Name: "erubi", @@ -1186,20 +1279,6 @@ func TestArtifact_Inspect(t *testing.T) { }, }, }, - { - ID: "faker@1.9.3", - Name: "faker", - Version: "1.9.3", - Indirect: false, - Relationship: types.RelationshipDirect, - DependsOn: []string{"i18n@1.6.0"}, - Locations: []types.Location{ - { - StartLine: 53, - EndLine: 53, - }, - }, - }, { ID: "globalid@0.4.2", Name: "globalid", @@ -1242,20 +1321,6 @@ func TestArtifact_Inspect(t *testing.T) { }, }, }, - { - ID: "json@2.2.0", - Name: "json", - Version: "2.2.0", - Indirect: false, - Relationship: types.RelationshipDirect, - DependsOn: []string(nil), - Locations: []types.Location{ - { - StartLine: 60, - EndLine: 60, - }, - }, - }, { ID: "loofah@2.2.3", Name: "loofah", @@ -1427,23 +1492,6 @@ func TestArtifact_Inspect(t *testing.T) { }, }, }, - { - ID: "pry@0.12.2", - Name: "pry", - Version: "0.12.2", - Indirect: false, - Relationship: types.RelationshipDirect, - DependsOn: []string{ - "coderay@1.1.2", - "method_source@0.9.2", - }, - Locations: []types.Location{ - { - StartLine: 79, - EndLine: 79, - }, - }, - }, { ID: "psych@3.1.0", Name: "psych", @@ -1486,32 +1534,6 @@ func TestArtifact_Inspect(t *testing.T) { }, }, }, - { - ID: "rails@5.2.0", - Name: "rails", - Version: "5.2.0", - Indirect: false, - Relationship: types.RelationshipDirect, - DependsOn: []string{ - "actioncable@5.2.3", - "actionmailer@5.2.3", - "actionpack@5.2.3", - "actionview@5.2.3", - "activejob@5.2.3", - "activemodel@5.2.3", - "activerecord@5.2.3", - "activestorage@5.2.3", - "activesupport@5.2.3", - "railties@5.2.3", - "sprockets-rails@3.2.1", - }, - Locations: []types.Location{ - { - StartLine: 86, - EndLine: 86, - }, - }, - }, { ID: "rails-dom-testing@2.0.3", Name: "rails-dom-testing", @@ -1591,28 +1613,6 @@ func TestArtifact_Inspect(t *testing.T) { }, }, }, - { - ID: "rubocop@0.67.2", - Name: "rubocop", - Version: "0.67.2", - Indirect: false, - Relationship: types.RelationshipDirect, - DependsOn: []string{ - "jaro_winkler@1.5.2", - "parallel@1.17.0", - "parser@2.6.3.0", - "psych@3.1.0", - "rainbow@3.0.0", - "ruby-progressbar@1.10.0", - "unicode-display_width@1.5.0", - }, - Locations: []types.Location{ - { - StartLine: 112, - EndLine: 112, - }, - }, - }, { ID: "ruby-progressbar@1.10.0", Name: "ruby-progressbar", diff --git a/pkg/fanal/artifact/image/remote_sbom_test.go b/pkg/fanal/artifact/image/remote_sbom_test.go index b87588c10ed7..b38bdc5c6dc5 100644 --- a/pkg/fanal/artifact/image/remote_sbom_test.go +++ b/pkg/fanal/artifact/image/remote_sbom_test.go @@ -223,7 +223,7 @@ func TestArtifact_inspectOCIReferrerSBOM(t *testing.T) { putBlobExpectations: []cache.ArtifactCachePutBlobExpectation{ { Args: cache.ArtifactCachePutBlobArgs{ - BlobID: "sha256:7e0b5476a5ff5a10594ad1ed7566220fcc43ecff29b831236cb2e98e574a1d05", + BlobID: "sha256:a06ed679a3289fba254040e1ce8f3467fadcc454ee3d0d4720f6978065f56684", BlobInfo: types.BlobInfo{ SchemaVersion: types.BlobJSONSchemaVersion, Applications: []types.Application{ @@ -268,9 +268,9 @@ func TestArtifact_inspectOCIReferrerSBOM(t *testing.T) { want: types.ArtifactReference{ Name: registry + "/test/image:10", Type: types.ArtifactCycloneDX, - ID: "sha256:7e0b5476a5ff5a10594ad1ed7566220fcc43ecff29b831236cb2e98e574a1d05", + ID: "sha256:a06ed679a3289fba254040e1ce8f3467fadcc454ee3d0d4720f6978065f56684", BlobIDs: []string{ - "sha256:7e0b5476a5ff5a10594ad1ed7566220fcc43ecff29b831236cb2e98e574a1d05", + "sha256:a06ed679a3289fba254040e1ce8f3467fadcc454ee3d0d4720f6978065f56684", }, }, },