debian-mirror-gitlab/spec/factories/ci/bridge.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

90 lines
1.7 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2019-02-15 15:39:39 +05:30
FactoryBot.define do
2021-03-11 19:13:27 +05:30
factory :ci_bridge, class: 'Ci::Bridge', parent: :ci_processable do
2019-12-21 20:55:43 +05:30
name { 'bridge' }
2020-04-22 19:07:51 +05:30
created_at { '2013-10-29 09:50:00 CET' }
2019-12-21 20:55:43 +05:30
status { :created }
2019-02-15 15:39:39 +05:30
2019-03-02 22:35:43 +05:30
trait :variables do
2019-12-21 20:55:43 +05:30
yaml_variables do
[{ key: 'BRIDGE', value: 'cross', public: true }]
end
2019-03-02 22:35:43 +05:30
end
2019-12-21 20:55:43 +05:30
transient do
downstream { nil }
upstream { nil }
end
2019-03-02 22:35:43 +05:30
2019-02-15 15:39:39 +05:30
after(:build) do |bridge, evaluator|
bridge.project ||= bridge.pipeline.project
2019-03-02 22:35:43 +05:30
if evaluator.downstream.present?
bridge.options = bridge.options.to_h.merge(
trigger: { project: evaluator.downstream.full_path }
)
end
2019-10-12 21:52:04 +05:30
if evaluator.upstream.present?
bridge.options = bridge.options.to_h.merge(
bridge_needs: { pipeline: evaluator.upstream.full_path }
)
end
2019-02-15 15:39:39 +05:30
end
2020-04-22 19:07:51 +05:30
2023-04-23 21:23:45 +05:30
trait :retried do
retried { true }
end
trait :retryable do
success
end
2021-01-03 14:25:43 +05:30
trait :created do
status { 'created' }
end
2020-04-22 19:07:51 +05:30
trait :started do
started_at { '2013-10-29 09:51:28 CET' }
end
trait :finished do
started
finished_at { '2013-10-29 09:53:28 CET' }
end
2021-03-11 19:13:27 +05:30
trait :success do
finished
status { 'success' }
end
2020-04-22 19:07:51 +05:30
trait :failed do
finished
status { 'failed' }
end
2020-11-24 15:15:51 +05:30
trait :skipped do
started
status { 'skipped' }
end
trait :strategy_depend do
options { { trigger: { strategy: 'depend' } } }
end
2021-01-03 14:25:43 +05:30
trait :manual do
status { 'manual' }
self.when { 'manual' }
end
trait :playable do
manual
end
2021-03-11 19:13:27 +05:30
trait :allowed_to_fail do
allow_failure { true }
end
2019-02-15 15:39:39 +05:30
end
end