diff options
Diffstat (limited to 'spec/factories/ci')
-rw-r--r-- | spec/factories/ci/builds.rb | 11 | ||||
-rw-r--r-- | spec/factories/ci/job_artifacts.rb | 12 | ||||
-rw-r--r-- | spec/factories/ci/pipeline_artifacts.rb | 4 | ||||
-rw-r--r-- | spec/factories/ci/pipelines.rb | 6 | ||||
-rw-r--r-- | spec/factories/ci/runner_namespaces.rb | 8 |
5 files changed, 35 insertions, 6 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index b06d581d2c0..f99021ad223 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -include ActionDispatch::TestProcess - FactoryBot.define do factory :ci_build, class: 'Ci::Build', parent: :ci_processable do name { 'test' } @@ -371,6 +369,12 @@ FactoryBot.define do end end + trait :codequality_reports_without_degradation do + after(:build) do |build| + build.job_artifacts << create(:ci_job_artifact, :codequality_without_errors, job: build) + end + end + trait :terraform_reports do after(:build) do |build| build.job_artifacts << create(:ci_job_artifact, :terraform, job: build) @@ -427,7 +431,8 @@ FactoryBot.define do name: 'Release $CI_COMMIT_SHA', description: 'Created using the release-cli $EXTRA_DESCRIPTION', tag_name: 'release-$CI_COMMIT_SHA', - ref: '$CI_COMMIT_SHA' + ref: '$CI_COMMIT_SHA', + assets: { links: [{ name: 'asset1', url: 'https://example.com/assets/1' }] } } } end diff --git a/spec/factories/ci/job_artifacts.rb b/spec/factories/ci/job_artifacts.rb index bfd8506566b..17cd495e217 100644 --- a/spec/factories/ci/job_artifacts.rb +++ b/spec/factories/ci/job_artifacts.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -include ActionDispatch::TestProcess - FactoryBot.define do factory :ci_job_artifact, class: 'Ci::JobArtifact' do job factory: :ci_build @@ -279,6 +277,16 @@ FactoryBot.define do end end + trait :sast_minimal do + file_type { :sast } + file_format { :raw } + + after(:build) do |artifact, _| + artifact.file = fixture_file_upload( + Rails.root.join('spec/fixtures/security_reports/master/gl-sast-report-minimal.json'), 'application/json') + end + end + trait :secret_detection do file_type { :secret_detection } file_format { :raw } diff --git a/spec/factories/ci/pipeline_artifacts.rb b/spec/factories/ci/pipeline_artifacts.rb index 3250c7abb4b..85277ce6fbf 100644 --- a/spec/factories/ci/pipeline_artifacts.rb +++ b/spec/factories/ci/pipeline_artifacts.rb @@ -13,6 +13,10 @@ FactoryBot.define do Rails.root.join('spec/fixtures/pipeline_artifacts/code_coverage.json'), 'application/json') end + trait :unlocked do + association :pipeline, :unlocked, factory: :ci_pipeline + end + trait :checksummed do verification_checksum { 'abc' } end diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb index 87b9a6c0e23..4fc7d945881 100644 --- a/spec/factories/ci/pipelines.rb +++ b/spec/factories/ci/pipelines.rb @@ -81,6 +81,10 @@ FactoryBot.define do status { :failed } end + trait :unlocked do + locked { Ci::Pipeline.lockeds[:unlocked] } + end + trait :protected do add_attribute(:protected) { true } end @@ -237,7 +241,7 @@ FactoryBot.define do trait :merged_result_pipeline do detached_merge_request_pipeline - sha { 'test-merge-sha'} + sha { 'mergeSha' } ref { merge_request.merge_ref_path } source_sha { merge_request.source_branch_sha } target_sha { merge_request.target_branch_sha } diff --git a/spec/factories/ci/runner_namespaces.rb b/spec/factories/ci/runner_namespaces.rb new file mode 100644 index 00000000000..a5060d196ca --- /dev/null +++ b/spec/factories/ci/runner_namespaces.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :ci_runner_namespace, class: 'Ci::RunnerNamespace' do + runner factory: [:ci_runner, :group] + group + end +end |