diff options
author | Tiger <twatson@gitlab.com> | 2019-03-13 06:06:54 +0300 |
---|---|---|
committer | Tiger <twatson@gitlab.com> | 2019-03-20 04:04:46 +0300 |
commit | 89b0bc04b9927abc85ce5fc3735438f956a8d5a2 (patch) | |
tree | 29355d49ce1a784b4695b4897880c6fe2879d353 /spec/models/deployment_spec.rb | |
parent | 759dab5b69f53a861045ebbc84836f83c7502af2 (diff) |
Create one Kubernetes namespace for a deployment
Instead of creating a Kubernetes namespace on every
cluster related to a project, only create one on the
cluster the project is about to be deployed to.
Diffstat (limited to 'spec/models/deployment_spec.rb')
-rw-r--r-- | spec/models/deployment_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb index a8d53cfcd7d..5fce9504334 100644 --- a/spec/models/deployment_spec.rb +++ b/spec/models/deployment_spec.rb @@ -356,4 +356,32 @@ describe Deployment do end end end + + describe '#cluster' do + let(:deployment) { create(:deployment) } + let(:project) { deployment.project } + let(:environment) { deployment.environment } + + subject { deployment.cluster } + + before do + expect(project).to receive(:deployment_platform) + .with(environment: environment.name).and_call_original + end + + context 'project has no deployment platform' do + before do + expect(project.clusters).to be_empty + end + + it { is_expected.to be_nil } + end + + context 'project has a deployment platform' do + let!(:cluster) { create(:cluster, projects: [project]) } + let!(:platform) { create(:cluster_platform_kubernetes, cluster: cluster) } + + it { is_expected.to eq cluster } + end + end end |