summaryrefslogtreecommitdiff
path: root/spec/factories/ci
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/ci')
-rw-r--r--spec/factories/ci/builds.rb32
-rw-r--r--spec/factories/ci/job_artifacts.rb15
-rw-r--r--spec/factories/ci/job_token/project_scope_links.rb9
3 files changed, 33 insertions, 23 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb
index f99021ad223..395d3ea598c 100644
--- a/spec/factories/ci/builds.rb
+++ b/spec/factories/ci/builds.rb
@@ -79,6 +79,7 @@ FactoryBot.define do
trait :pending do
queued_at { 'Di 29. Okt 09:50:59 CET 2013' }
+
status { 'pending' }
end
@@ -237,6 +238,20 @@ FactoryBot.define do
coverage_regex { '/(d+)/' }
end
+ trait :trace_with_coverage do
+ coverage { nil }
+ coverage_regex { '(\d+\.\d+)%' }
+
+ transient do
+ trace_coverage { 60.0 }
+ end
+
+ after(:create) do |build, evaluator|
+ build.trace.set("Coverage #{evaluator.trace_coverage}%")
+ build.trace.archive! if build.complete?
+ end
+ end
+
trait :trace_live do
after(:create) do |build, evaluator|
build.trace.set('BUILD TRACE')
@@ -286,6 +301,15 @@ FactoryBot.define do
trait :queued do
queued_at { Time.now }
+
+ after(:create) do |build|
+ build.create_queuing_entry!
+ end
+ end
+
+ trait :picked do
+ running
+
runner factory: :ci_runner
end
@@ -484,14 +508,6 @@ FactoryBot.define do
end
end
- trait :license_management do
- options do
- {
- artifacts: { reports: { license_management: 'gl-license-management-report.json' } }
- }
- end
- end
-
trait :license_scanning do
options do
{
diff --git a/spec/factories/ci/job_artifacts.rb b/spec/factories/ci/job_artifacts.rb
index 17cd495e217..642437b1119 100644
--- a/spec/factories/ci/job_artifacts.rb
+++ b/spec/factories/ci/job_artifacts.rb
@@ -317,21 +317,6 @@ FactoryBot.define do
end
end
- trait :cluster_applications do
- file_type { :cluster_applications }
- file_format { :gzip }
-
- transient do
- file do
- fixture_file_upload(Rails.root.join('spec/fixtures/helm/helm_list_v2_prometheus_missing.json.gz'), 'application/x-gzip')
- end
- end
-
- after(:build) do |artifact, evaluator|
- artifact.file = evaluator.file
- end
- end
-
trait :correct_checksum do
after(:build) do |artifact, evaluator|
artifact.file_sha256 = Digest::SHA256.file(artifact.file.path).hexdigest
diff --git a/spec/factories/ci/job_token/project_scope_links.rb b/spec/factories/ci/job_token/project_scope_links.rb
new file mode 100644
index 00000000000..a11edd87e4e
--- /dev/null
+++ b/spec/factories/ci/job_token/project_scope_links.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :ci_job_token_project_scope_link, class: 'Ci::JobToken::ProjectScopeLink' do
+ association :source_project, factory: :project
+ association :target_project, factory: :project
+ association :added_by, factory: :user
+ end
+end