Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/ci')
-rw-r--r--spec/factories/ci/build_trace_chunks.rb4
-rw-r--r--spec/factories/ci/builds.rb20
-rw-r--r--spec/factories/ci/job_artifacts.rb33
-rw-r--r--spec/factories/ci/pipeline_artifacts.rb2
-rw-r--r--spec/factories/ci/reports/sbom/components.rb19
-rw-r--r--spec/factories/ci/reports/sbom/sources.rb34
6 files changed, 76 insertions, 36 deletions
diff --git a/spec/factories/ci/build_trace_chunks.rb b/spec/factories/ci/build_trace_chunks.rb
index 115eb32111c..64a297932de 100644
--- a/spec/factories/ci/build_trace_chunks.rb
+++ b/spec/factories/ci/build_trace_chunks.rb
@@ -23,7 +23,7 @@ FactoryBot.define do
end
trait :database_with_data do
- data_store { :database}
+ data_store { :database }
transient do
initial_data { 'test data' }
@@ -55,7 +55,7 @@ FactoryBot.define do
end
trait :persisted do
- data_store { :database}
+ data_store { :database }
transient do
initial_data { 'test data' }
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb
index d684f79a518..8c2edc8cd9f 100644
--- a/spec/factories/ci/builds.rb
+++ b/spec/factories/ci/builds.rb
@@ -129,8 +129,8 @@ FactoryBot.define do
{
script: %w(ls),
environment: { name: 'staging',
- action: 'stop',
- url: 'http://staging.example.com/$CI_JOB_NAME' }
+ action: 'stop',
+ url: 'http://staging.example.com/$CI_JOB_NAME' }
}
end
end
@@ -141,9 +141,9 @@ FactoryBot.define do
{
script: %w(ls),
environment: { name: 'test_portal',
- action: 'start',
- url: 'http://staging.example.com/$CI_JOB_NAME',
- deployment_tier: 'testing' }
+ action: 'start',
+ url: 'http://staging.example.com/$CI_JOB_NAME',
+ deployment_tier: 'testing' }
}
end
end
@@ -155,7 +155,7 @@ FactoryBot.define do
{
script: %w(ls),
environment: { name: 'production',
- url: 'http://prd.example.com/$CI_JOB_NAME' }
+ url: 'http://prd.example.com/$CI_JOB_NAME' }
}
end
end
@@ -167,8 +167,8 @@ FactoryBot.define do
{
script: %w(ls),
environment: { name: 'review/$CI_COMMIT_REF_NAME',
- url: 'http://staging.example.com/$CI_JOB_NAME',
- on_stop: 'stop_review_app' }
+ url: 'http://staging.example.com/$CI_JOB_NAME',
+ on_stop: 'stop_review_app' }
}
end
end
@@ -181,8 +181,8 @@ FactoryBot.define do
{
script: %w(ls),
environment: { name: 'review/$CI_COMMIT_REF_NAME',
- url: 'http://staging.example.com/$CI_JOB_NAME',
- action: 'stop' }
+ url: 'http://staging.example.com/$CI_JOB_NAME',
+ action: 'stop' }
}
end
end
diff --git a/spec/factories/ci/job_artifacts.rb b/spec/factories/ci/job_artifacts.rb
index 114ad3a5847..f8b964cf8e0 100644
--- a/spec/factories/ci/job_artifacts.rb
+++ b/spec/factories/ci/job_artifacts.rb
@@ -15,7 +15,7 @@ FactoryBot.define do
end
trait :remote_store do
- file_store { JobArtifactUploader::Store::REMOTE}
+ file_store { JobArtifactUploader::Store::REMOTE }
end
after :build do |artifact|
@@ -102,28 +102,6 @@ FactoryBot.define do
end
end
- trait :zip_with_single_file do
- file_type { :archive }
- file_format { :zip }
-
- after(:build) do |artifact, evaluator|
- artifact.file = fixture_file_upload(
- Rails.root.join('spec/fixtures/lib/gitlab/ci/build/artifacts/adapters/zip_stream/single_file.zip'),
- 'application/zip')
- end
- end
-
- trait :zip_with_multiple_files do
- file_type { :archive }
- file_format { :zip }
-
- after(:build) do |artifact, evaluator|
- artifact.file = fixture_file_upload(
- Rails.root.join('spec/fixtures/lib/gitlab/ci/build/artifacts/adapters/zip_stream/multiple_files.zip'),
- 'application/zip')
- end
- end
-
trait :junit do
file_type { :junit }
file_format { :gzip }
@@ -384,6 +362,15 @@ FactoryBot.define do
end
end
+ trait :common_security_report_without_top_level_scanner do
+ common_security_report
+
+ after(:build) do |artifact, _|
+ artifact.file = fixture_file_upload(
+ Rails.root.join('spec/fixtures/security_reports/master/gl-common-scanning-report-without-top-level-scanner.json'), 'application/json')
+ end
+ end
+
trait :common_security_report_with_blank_names do
file_format { :raw }
file_type { :dependency_scanning }
diff --git a/spec/factories/ci/pipeline_artifacts.rb b/spec/factories/ci/pipeline_artifacts.rb
index 85277ce6fbf..d096f149c3a 100644
--- a/spec/factories/ci/pipeline_artifacts.rb
+++ b/spec/factories/ci/pipeline_artifacts.rb
@@ -30,7 +30,7 @@ FactoryBot.define do
end
trait :remote_store do
- file_store { ::ObjectStorage::Store::REMOTE}
+ file_store { ::ObjectStorage::Store::REMOTE }
end
trait :with_coverage_report do
diff --git a/spec/factories/ci/reports/sbom/components.rb b/spec/factories/ci/reports/sbom/components.rb
new file mode 100644
index 00000000000..317e1c863cf
--- /dev/null
+++ b/spec/factories/ci/reports/sbom/components.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :ci_reports_sbom_component, class: '::Gitlab::Ci::Reports::Sbom::Component' do
+ type { :library }
+ sequence(:name) { |n| "component-#{n}" }
+ sequence(:version) { |n| "v0.0.#{n}" }
+
+ skip_create
+
+ initialize_with do
+ ::Gitlab::Ci::Reports::Sbom::Component.new(
+ type: type,
+ name: name,
+ version: version
+ )
+ end
+ end
+end
diff --git a/spec/factories/ci/reports/sbom/sources.rb b/spec/factories/ci/reports/sbom/sources.rb
new file mode 100644
index 00000000000..9093aba86a6
--- /dev/null
+++ b/spec/factories/ci/reports/sbom/sources.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :ci_reports_sbom_source, class: '::Gitlab::Ci::Reports::Sbom::Source' 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
+
+ fingerprint { Digest::SHA256.hexdigest(data.to_json) }
+
+ skip_create
+
+ initialize_with do
+ ::Gitlab::Ci::Reports::Sbom::Source.new(
+ type: type,
+ data: data,
+ fingerprint: fingerprint
+ )
+ end
+ end
+end