summaryrefslogtreecommitdiff
path: root/spec/factories/ci
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
commitb39512ed755239198a9c294b6a45e65c05900235 (patch)
treed234a3efade1de67c46b9e5a38ce813627726aa7 /spec/factories/ci
parentd31474cf3b17ece37939d20082b07f6657cc79a9 (diff)
downloadgitlab-ce-b39512ed755239198a9c294b6a45e65c05900235.tar.gz
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/factories/ci')
-rw-r--r--spec/factories/ci/builds.rb27
-rw-r--r--spec/factories/ci/job_artifacts.rb22
-rw-r--r--spec/factories/ci/runners.rb4
-rw-r--r--spec/factories/ci/secure_files.rb6
-rw-r--r--spec/factories/ci/variables.rb1
5 files changed, 58 insertions, 2 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb
index 97ddbf21b99..d684f79a518 100644
--- a/spec/factories/ci/builds.rb
+++ b/spec/factories/ci/builds.rb
@@ -504,6 +504,20 @@ FactoryBot.define do
artifacts_expire_at { 1.minute.ago }
end
+ trait :with_artifacts_paths do
+ options do
+ {
+ artifacts: {
+ name: 'artifacts_file',
+ untracked: false,
+ paths: ['out/'],
+ when: 'always',
+ expire_in: '7d'
+ }
+ }
+ end
+ end
+
trait :with_commit do
after(:build) do |build|
commit = build(:commit, :without_author)
@@ -645,6 +659,19 @@ FactoryBot.define do
end
end
+ trait :multiple_report_artifacts do
+ options do
+ {
+ artifacts: {
+ reports: {
+ sast: 'gl-sast-report.json',
+ container_scanning: 'gl-container-scanning-report.json'
+ }
+ }
+ }
+ end
+ end
+
trait :non_public_artifacts do
options do
{
diff --git a/spec/factories/ci/job_artifacts.rb b/spec/factories/ci/job_artifacts.rb
index cdbcdced5f4..114ad3a5847 100644
--- a/spec/factories/ci/job_artifacts.rb
+++ b/spec/factories/ci/job_artifacts.rb
@@ -102,6 +102,28 @@ 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 }
diff --git a/spec/factories/ci/runners.rb b/spec/factories/ci/runners.rb
index 18026412261..4758986b47c 100644
--- a/spec/factories/ci/runners.rb
+++ b/spec/factories/ci/runners.rb
@@ -18,11 +18,11 @@ FactoryBot.define do
after(:build) do |runner, evaluator|
evaluator.projects.each do |proj|
- runner.runner_projects << build(:ci_runner_project, project: proj)
+ runner.runner_projects << build(:ci_runner_project, runner: runner, project: proj)
end
evaluator.groups.each do |group|
- runner.runner_namespaces << build(:ci_runner_namespace, namespace: group)
+ runner.runner_namespaces << build(:ci_runner_namespace, runner: runner, namespace: group)
end
end
diff --git a/spec/factories/ci/secure_files.rb b/spec/factories/ci/secure_files.rb
index 9afec5db858..74988202c71 100644
--- a/spec/factories/ci/secure_files.rb
+++ b/spec/factories/ci/secure_files.rb
@@ -6,5 +6,11 @@ FactoryBot.define do
file { fixture_file_upload('spec/fixtures/ci_secure_files/upload-keystore.jks', 'application/octet-stream') }
checksum { 'foo1234' }
project
+
+ trait :remote_store do
+ after(:create) do |ci_secure_file|
+ ci_secure_file.update!(file_store: ObjectStorage::Store::REMOTE)
+ end
+ end
end
end
diff --git a/spec/factories/ci/variables.rb b/spec/factories/ci/variables.rb
index a4cbf873b0b..1f9c12ecbce 100644
--- a/spec/factories/ci/variables.rb
+++ b/spec/factories/ci/variables.rb
@@ -5,6 +5,7 @@ FactoryBot.define do
sequence(:key) { |n| "VARIABLE_#{n}" }
value { 'VARIABLE_VALUE' }
masked { false }
+ variable_type { :env_var }
trait(:protected) do
add_attribute(:protected) { true }