summaryrefslogtreecommitdiff
path: root/spec/models/project_spec.rb
diff options
context:
space:
mode:
authorTiger <twatson@gitlab.com>2019-05-31 12:44:59 -0500
committerTiger <twatson@gitlab.com>2019-06-21 14:40:24 +1000
commit89a1594a244face6071ad5173ff86df13e446794 (patch)
treee146be3227f43193f791f23290e60cbd694b1902 /spec/models/project_spec.rb
parent9f07114618f957941953d0374fa43ab010a8ec9f (diff)
downloadgitlab-ce-89a1594a244face6071ad5173ff86df13e446794.tar.gz
Pass environment when finding deployment variables61156-pass-environment-when-generating-deployment-variables
This will enable looking up Kubernetes namespaces based on the environment being deployed to, instead of using a single namespace across all environments.
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r--spec/models/project_spec.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index cc0f5002a1e..4537d44d1fd 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -2655,9 +2655,14 @@ describe Project do
context 'when user configured kubernetes from CI/CD > Clusters and KubernetesNamespace migration has not been executed' do
let!(:cluster) { create(:cluster, :project, :provided_by_gcp) }
let(:project) { cluster.project }
+ let!(:environment) { create(:environment, project: project) }
+
+ let(:deployment_variables) do
+ project.deployment_variables(environment_name: environment.name, persisted_environment: environment)
+ end
it 'does not return variables from this service' do
- expect(project.deployment_variables).not_to include(
+ expect(deployment_variables).not_to include(
{ key: 'KUBE_TOKEN', value: project.deployment_platform.token, public: false, masked: true }
)
end
@@ -2667,9 +2672,14 @@ describe Project do
let!(:kubernetes_namespace) { create(:cluster_kubernetes_namespace, :with_token) }
let!(:cluster) { kubernetes_namespace.cluster }
let(:project) { kubernetes_namespace.project }
+ let!(:environment) { create(:environment, project: project) }
+
+ let(:deployment_variables) do
+ project.deployment_variables(environment_name: environment.name, persisted_environment: environment)
+ end
it 'returns token from kubernetes namespace' do
- expect(project.deployment_variables).to include(
+ expect(deployment_variables).to include(
{ key: 'KUBE_TOKEN', value: kubernetes_namespace.service_account_token, public: false, masked: true }
)
end