gitlab-org--gitlab-foss/spec/factories/clusters/clusters.rb

60 lines
1.4 KiB
Ruby
Raw Normal View History

FactoryBot.define do
2017-10-29 14:48:45 -04:00
factory :cluster, class: Clusters::Cluster do
user
name 'test-cluster'
cluster_type :project_type
trait :instance do
cluster_type { Clusters::Cluster.cluster_types[:instance_type] }
end
2017-10-29 14:48:45 -04:00
trait :project do
cluster_type { Clusters::Cluster.cluster_types[:project_type] }
before(:create) do |cluster, evaluator|
cluster.projects << create(:project, :repository)
2017-10-29 14:48:45 -04:00
end
end
trait :group do
cluster_type { Clusters::Cluster.cluster_types[:group_type] }
before(:create) do |cluster, evalutor|
cluster.groups << create(:group)
end
end
2017-10-29 14:48:45 -04:00
trait :provided_by_user do
provider_type :user
platform_type :kubernetes
2017-10-30 08:55:18 -04:00
2017-12-03 15:36:01 -05:00
platform_kubernetes factory: [:cluster_platform_kubernetes, :configured]
2017-10-29 14:48:45 -04:00
end
trait :provided_by_gcp do
provider_type :gcp
platform_type :kubernetes
2017-10-30 08:55:18 -04:00
2017-12-03 15:36:01 -05:00
provider_gcp factory: [:cluster_provider_gcp, :created]
platform_kubernetes factory: [:cluster_platform_kubernetes, :configured]
2017-10-29 14:48:45 -04:00
end
trait :providing_by_gcp do
provider_type :gcp
2017-12-03 15:36:01 -05:00
provider_gcp factory: [:cluster_provider_gcp, :creating]
2017-10-29 14:48:45 -04:00
end
trait :disabled do
enabled false
end
trait :production_environment do
sequence(:environment_scope) { |n| "production#{n}/*" }
end
trait :with_installed_helm do
application_helm factory: %i(clusters_applications_helm installed)
end
2017-10-29 14:48:45 -04:00
end
end