gitlab-org--gitlab-foss/spec/factories/clusters/kubernetes_namespaces.rb
Thong Kuah a97d876751 Fallback to admin token for project clusters only
We do not want group level clusters to fall back to what was old
behaviour for project level clusters. So instead we will not return any
KUBE_TOKEN if we cannot find a suitable kubernetes_namespace for the
project, in the group level cluster case.

Add test cases to assert above
2018-12-04 15:44:33 +13:00

20 lines
604 B
Ruby

# frozen_string_literal: true
FactoryBot.define do
factory :cluster_kubernetes_namespace, class: Clusters::KubernetesNamespace do
association :cluster, :project, :provided_by_gcp
after(:build) do |kubernetes_namespace|
if kubernetes_namespace.cluster.project_type?
cluster_project = kubernetes_namespace.cluster.cluster_project
kubernetes_namespace.project = cluster_project.project
kubernetes_namespace.cluster_project = cluster_project
end
end
trait :with_token do
service_account_token { FFaker::Lorem.characters(10) }
end
end
end