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

64 lines
1.2 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
FactoryBot.define do
2020-03-13 15:44:24 +05:30
factory :ci_runner, class: 'Ci::Runner' do
2017-08-17 22:00:37 +05:30
sequence(:description) { |n| "My runner#{n}" }
2015-09-25 12:07:36 +05:30
2019-12-21 20:55:43 +05:30
platform { "darwin" }
active { true }
access_level { :not_protected }
2015-09-25 12:07:36 +05:30
2019-12-21 20:55:43 +05:30
runner_type { :instance_type }
2018-11-08 19:23:39 +05:30
2017-08-17 22:00:37 +05:30
trait :online do
2018-12-05 23:21:45 +05:30
contacted_at { Time.now }
2017-08-17 22:00:37 +05:30
end
2018-11-08 19:23:39 +05:30
trait :instance do
2019-12-21 20:55:43 +05:30
runner_type { :instance_type }
2018-11-08 19:23:39 +05:30
end
trait :group do
2019-12-21 20:55:43 +05:30
runner_type { :group_type }
2018-11-08 19:23:39 +05:30
after(:build) do |runner, evaluator|
runner.groups << build(:group) if runner.groups.empty?
end
end
trait :project do
2019-12-21 20:55:43 +05:30
runner_type { :project_type }
2018-11-08 19:23:39 +05:30
after(:build) do |runner, evaluator|
runner.projects << build(:project) if runner.projects.empty?
end
2015-09-25 12:07:36 +05:30
end
2016-09-29 09:46:39 +05:30
2018-11-08 19:23:39 +05:30
trait :without_projects do
# we use that to create invalid runner:
# the one without projects
after(:create) do |runner, evaluator|
runner.runner_projects.delete_all
end
2017-08-17 22:00:37 +05:30
end
2016-09-29 09:46:39 +05:30
trait :inactive do
2019-12-21 20:55:43 +05:30
active { false }
2016-09-29 09:46:39 +05:30
end
2018-03-17 18:26:18 +05:30
trait :ref_protected do
2019-12-21 20:55:43 +05:30
access_level { :ref_protected }
2018-03-17 18:26:18 +05:30
end
2018-12-13 13:39:08 +05:30
trait :tagged_only do
2019-12-21 20:55:43 +05:30
run_untagged { false }
2018-12-13 13:39:08 +05:30
2019-12-21 20:55:43 +05:30
tag_list { %w(tag1 tag2) }
2018-12-13 13:39:08 +05:30
end
trait :locked do
2019-12-21 20:55:43 +05:30
locked { true }
2018-12-13 13:39:08 +05:30
end
2015-09-25 12:07:36 +05:30
end
end