diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
commit | 7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch) | |
tree | 5bdc2229f5198d516781f8d24eace62fc7e589e9 /spec/factories/ci/builds.rb | |
parent | 185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff) |
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'spec/factories/ci/builds.rb')
-rw-r--r-- | spec/factories/ci/builds.rb | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index 9a3b2837ab8..b88d6b5fda4 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -24,6 +24,16 @@ FactoryBot.define do project { pipeline.project } + trait :with_token do + transient do + generate_token { true } + end + + after(:build) do |build, evaluator| + build.ensure_token if evaluator.generate_token + end + end + trait :degenerated do options { nil } yaml_variables { nil } @@ -93,6 +103,7 @@ FactoryBot.define do end trait :pending do + with_token queued_at { 'Di 29. Okt 09:50:59 CET 2013' } status { 'pending' } @@ -100,6 +111,7 @@ FactoryBot.define do trait :created do status { 'created' } + generate_token { false } end trait :preparing do @@ -303,14 +315,11 @@ FactoryBot.define do # Build deployment/environment relations if environment name is set # to the job. If `build.deployment` has already been set, it doesn't # build a new instance. - environment = Gitlab::Ci::Pipeline::Seed::Environment.new(build).to_resource + Environments::CreateForBuildService.new.execute(build) + end - build.assign_attributes( - deployment: Gitlab::Ci::Pipeline::Seed::Deployment.new(build, environment).to_resource, - metadata_attributes: { - expanded_environment_name: environment.name - } - ) + after(:create) do |build, evaluator| + Deployments::CreateForBuildService.new.execute(build) end end @@ -716,7 +725,7 @@ FactoryBot.define do trait :with_runner_session do after(:build) do |build| - build.build_runner_session(url: 'https://localhost') + build.build_runner_session(url: 'https://gitlab.example.com') end end |