diff options
Diffstat (limited to 'spec/factories/ci/reports')
-rw-r--r-- | spec/factories/ci/reports/sbom/sources.rb | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/spec/factories/ci/reports/sbom/sources.rb b/spec/factories/ci/reports/sbom/sources.rb index 688c0250b5f..a82dac1d7e2 100644 --- a/spec/factories/ci/reports/sbom/sources.rb +++ b/spec/factories/ci/reports/sbom/sources.rb @@ -2,21 +2,50 @@ FactoryBot.define do factory :ci_reports_sbom_source, class: '::Gitlab::Ci::Reports::Sbom::Source' do - type { :dependency_scanning } + dependency_scanning - transient do - sequence(:input_file_path) { |n| "subproject-#{n}/package-lock.json" } - sequence(:source_file_path) { |n| "subproject-#{n}/package.json" } + trait :dependency_scanning do + type { :dependency_scanning } + + transient do + sequence(:input_file_path) { |n| "subproject-#{n}/package-lock.json" } + sequence(:source_file_path) { |n| "subproject-#{n}/package.json" } + end + + data do + { + 'category' => 'development', + 'input_file' => { 'path' => input_file_path }, + 'source_file' => { 'path' => source_file_path }, + 'package_manager' => { 'name' => 'npm' }, + 'language' => { 'name' => 'JavaScript' } + } + end end - data do - { - 'category' => 'development', - 'input_file' => { 'path' => input_file_path }, - 'source_file' => { 'path' => source_file_path }, - 'package_manager' => { 'name' => 'npm' }, - 'language' => { 'name' => 'JavaScript' } - } + trait :container_scanning do + type { :container_scanning } + + transient do + image_name { 'photon' } + sequence(:image_tag) { |n| "5.#{n}-12345678" } + operating_system_name { 'Photon OS' } + sequence(:operating_system_version) { |n| "5.#{n}" } + end + + data do + { + 'category' => 'development', + 'image' => { + 'name' => image_name, + 'tag' => image_tag + }, + 'operating_system' => { + 'name' => operating_system_name, + 'version' => operating_system_version + } + } + end end skip_create |