clusters.rb 947 Bytes
Newer Older
1
FactoryBot.define do
2 3 4 5 6 7 8 9 10 11 12 13 14
  factory :cluster, class: Clusters::Cluster do
    user
    name 'test-cluster'

    trait :project do
      after(:create) do |cluster, evaluator|
        cluster.projects << create(:project)
      end
    end

    trait :provided_by_user do
      provider_type :user
      platform_type :kubernetes
15

Kamil Trzcinski's avatar
Kamil Trzcinski committed
16
      platform_kubernetes factory: [:cluster_platform_kubernetes, :configured]
17 18 19 20 21
    end

    trait :provided_by_gcp do
      provider_type :gcp
      platform_type :kubernetes
22

Kamil Trzcinski's avatar
Kamil Trzcinski committed
23 24
      provider_gcp factory: [:cluster_provider_gcp, :created]
      platform_kubernetes factory: [:cluster_platform_kubernetes, :configured]
25 26 27 28
    end

    trait :providing_by_gcp do
      provider_type :gcp
Kamil Trzcinski's avatar
Kamil Trzcinski committed
29
      provider_gcp factory: [:cluster_provider_gcp, :creating]
30
    end
31 32 33 34

    trait :disabled do
      enabled false
    end
35 36 37 38

    trait :production_environment do
      sequence(:environment_scope) { |n| "production#{n}/*" }
    end
39 40
  end
end