summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTiger <twatson@gitlab.com>2019-06-18 15:29:25 +1000
committerTiger <twatson@gitlab.com>2019-06-21 11:35:13 +1000
commitda5c00d1c669c1aa4ebc714cfc357fc73f3e1331 (patch)
tree7fec1a32df975d73c75deb4d7e7dcb3ce9915ac6 /spec
parent148516ba36855095fa995c2d4e8077919cdb6db6 (diff)
downloadgitlab-ce-da5c00d1c669c1aa4ebc714cfc357fc73f3e1331.tar.gz
Remove Kubernetes service from deployment platform
This will no longer be used for deployments, as all service templates have been migrated to clusters.
Diffstat (limited to 'spec')
-rw-r--r--spec/models/concerns/deployment_platform_spec.rb53
-rw-r--r--spec/models/project_services/kubernetes_service_spec.rb2
2 files changed, 2 insertions, 53 deletions
diff --git a/spec/models/concerns/deployment_platform_spec.rb b/spec/models/concerns/deployment_platform_spec.rb
index 0e34d8fccf3..96465a51db2 100644
--- a/spec/models/concerns/deployment_platform_spec.rb
+++ b/spec/models/concerns/deployment_platform_spec.rb
@@ -8,40 +8,7 @@ describe DeploymentPlatform do
describe '#deployment_platform' do
subject { project.deployment_platform }
- context 'with no Kubernetes configuration on CI/CD, no Kubernetes Service and a Kubernetes template configured' do
- let!(:kubernetes_service) { create(:kubernetes_service, template: true) }
-
- it 'returns a platform kubernetes' do
- expect(subject).to be_a_kind_of(Clusters::Platforms::Kubernetes)
- end
-
- it 'creates a cluster and a platform kubernetes' do
- expect { subject }
- .to change { Clusters::Cluster.count }.by(1)
- .and change { Clusters::Platforms::Kubernetes.count }.by(1)
- end
-
- it 'includes appropriate attributes for Cluster' do
- cluster = subject.cluster
- expect(cluster.name).to eq('kubernetes-template')
- expect(cluster.project).to eq(project)
- expect(cluster.provider_type).to eq('user')
- expect(cluster.platform_type).to eq('kubernetes')
- end
-
- it 'creates a platform kubernetes' do
- expect { subject }.to change { Clusters::Platforms::Kubernetes.count }.by(1)
- end
-
- it 'copies attributes from Clusters::Platform::Kubernetes template into the new Cluster::Platforms::Kubernetes' do
- expect(subject.api_url).to eq(kubernetes_service.api_url)
- expect(subject.ca_pem).to eq(kubernetes_service.ca_pem)
- expect(subject.token).to eq(kubernetes_service.token)
- expect(subject.namespace).to eq(kubernetes_service.namespace)
- end
- end
-
- context 'with no Kubernetes configuration on CI/CD, no Kubernetes Service and no Kubernetes template configured' do
+ context 'with no Kubernetes configuration on CI/CD, no Kubernetes Service' do
it { is_expected.to be_nil }
end
@@ -126,23 +93,5 @@ describe DeploymentPlatform do
end
end
end
-
- context 'when user configured kubernetes integration from project services' do
- let!(:kubernetes_service) { create(:kubernetes_service, project: project) }
-
- it 'returns the Kubernetes service' do
- expect(subject).to eq(kubernetes_service)
- end
- end
-
- context 'when the cluster creation fails' do
- let!(:kubernetes_service) { create(:kubernetes_service, template: true) }
-
- before do
- allow_any_instance_of(Clusters::Cluster).to receive(:persisted?).and_return(false)
- end
-
- it { is_expected.to be_nil }
- end
end
end
diff --git a/spec/models/project_services/kubernetes_service_spec.rb b/spec/models/project_services/kubernetes_service_spec.rb
index 34ee1eafd5c..92e546b7880 100644
--- a/spec/models/project_services/kubernetes_service_spec.rb
+++ b/spec/models/project_services/kubernetes_service_spec.rb
@@ -7,7 +7,7 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
include ReactiveCachingHelpers
let(:project) { create(:kubernetes_project) }
- let(:service) { project.deployment_platform }
+ let(:service) { create(:kubernetes_service, project: project) }
describe 'Associations' do
it { is_expected.to belong_to :project }