2018-10-16 16:03:59 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
FactoryBot.define do
|
|
|
|
factory :cluster_kubernetes_namespace, class: Clusters::KubernetesNamespace do
|
2018-11-02 11:46:15 -04:00
|
|
|
association :cluster, :project, :provided_by_gcp
|
|
|
|
|
|
|
|
after(:build) do |kubernetes_namespace|
|
2018-11-26 23:30:09 -05:00
|
|
|
if kubernetes_namespace.cluster.project_type?
|
|
|
|
cluster_project = kubernetes_namespace.cluster.cluster_project
|
2018-11-02 11:46:15 -04:00
|
|
|
|
2018-11-26 23:30:09 -05:00
|
|
|
kubernetes_namespace.project = cluster_project.project
|
|
|
|
kubernetes_namespace.cluster_project = cluster_project
|
|
|
|
end
|
2018-11-02 11:46:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
trait :with_token do
|
2018-11-13 05:27:21 -05:00
|
|
|
service_account_token { FFaker::Lorem.characters(10) }
|
2018-11-02 11:46:15 -04:00
|
|
|
end
|
2018-10-16 16:03:59 -04:00
|
|
|
end
|
|
|
|
end
|