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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-17 21:09:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-17 21:09:44 +0300
commit2c156e3c7bbade01c36eee18327f1ced6eebea79 (patch)
tree115fa8dbf6bc05037378b380311d31acb805f54c /spec/factories
parent8e129497b2565b8c595ef4f806d9a9595ca654e5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/ci/builds.rb16
-rw-r--r--spec/factories/ci/job_artifacts.rb30
-rw-r--r--spec/factories/ci/pipelines.rb8
-rw-r--r--spec/factories/merge_requests.rb12
4 files changed, 66 insertions, 0 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb
index b6f18240b9e..446c1c59030 100644
--- a/spec/factories/ci/builds.rb
+++ b/spec/factories/ci/builds.rb
@@ -311,6 +311,12 @@ FactoryBot.define do
end
end
+ trait :coverage_reports do
+ after(:build) do |build|
+ build.job_artifacts << create(:ci_job_artifact, :cobertura, job: build)
+ end
+ end
+
trait :expired do
artifacts_expire_at { 1.minute.ago }
end
@@ -355,6 +361,8 @@ FactoryBot.define do
options { {} }
end
+ # TODO: move Security traits to ee_ci_build
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/210486
trait :dast do
options do
{
@@ -395,6 +403,14 @@ FactoryBot.define do
end
end
+ trait :license_scanning do
+ options do
+ {
+ artifacts: { reports: { license_management: 'gl-license-scanning-report.json' } }
+ }
+ end
+ end
+
trait :non_playable do
status { 'created' }
self.when { 'manual' }
diff --git a/spec/factories/ci/job_artifacts.rb b/spec/factories/ci/job_artifacts.rb
index e0942bf0ac3..8fbf242a607 100644
--- a/spec/factories/ci/job_artifacts.rb
+++ b/spec/factories/ci/job_artifacts.rb
@@ -129,6 +129,36 @@ FactoryBot.define do
end
end
+ trait :cobertura do
+ file_type { :cobertura }
+ file_format { :gzip }
+
+ after(:build) do |artifact, evaluator|
+ artifact.file = fixture_file_upload(
+ Rails.root.join('spec/fixtures/cobertura/coverage.xml.gz'), 'application/x-gzip')
+ end
+ end
+
+ trait :coverage_gocov_xml do
+ file_type { :cobertura }
+ file_format { :gzip }
+
+ after(:build) do |artifact, evaluator|
+ artifact.file = fixture_file_upload(
+ Rails.root.join('spec/fixtures/cobertura/coverage_gocov_xml.xml.gz'), 'application/x-gzip')
+ end
+ end
+
+ trait :coverage_with_corrupted_data do
+ file_type { :cobertura }
+ file_format { :gzip }
+
+ after(:build) do |artifact, evaluator|
+ artifact.file = fixture_file_upload(
+ Rails.root.join('spec/fixtures/cobertura/coverage_with_corrupted_data.xml.gz'), 'application/x-gzip')
+ end
+ end
+
trait :codequality do
file_type { :codequality }
file_format { :raw }
diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb
index 40b2aa3042e..11686ed5277 100644
--- a/spec/factories/ci/pipelines.rb
+++ b/spec/factories/ci/pipelines.rb
@@ -67,6 +67,14 @@ FactoryBot.define do
end
end
+ trait :with_coverage_reports do
+ status { :success }
+
+ after(:build) do |pipeline, evaluator|
+ pipeline.builds << build(:ci_build, :coverage_reports, pipeline: pipeline, project: pipeline.project)
+ end
+ end
+
trait :with_exposed_artifacts do
status { :success }
diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb
index 2344ffffa65..f717bab5f2a 100644
--- a/spec/factories/merge_requests.rb
+++ b/spec/factories/merge_requests.rb
@@ -121,6 +121,18 @@ FactoryBot.define do
end
end
+ trait :with_coverage_reports do
+ after(:build) do |merge_request|
+ merge_request.head_pipeline = build(
+ :ci_pipeline,
+ :success,
+ :with_coverage_reports,
+ project: merge_request.source_project,
+ ref: merge_request.source_branch,
+ sha: merge_request.diff_head_sha)
+ end
+ end
+
trait :with_exposed_artifacts do
after(:build) do |merge_request|
merge_request.head_pipeline = build(