diff options
author | Tiger <twatson@gitlab.com> | 2019-06-12 02:44:18 +0300 |
---|---|---|
committer | Tiger <twatson@gitlab.com> | 2019-06-18 05:43:52 +0300 |
commit | 74702f0e0e05bc346338fbd11b596fcbedfbaea6 (patch) | |
tree | e426ab17b7dc425c9d63dc9670b865fcbd17bb02 /spec | |
parent | db9ef69272155b3c8ead5c0e7d027bda2b623d43 (diff) |
Enable project-level JIT resource creation
Previously this behaviour was only available to group
and instance-level clusters, as some project clusters
relied on Kubernetes credentials being passed through
to the runner instead of having their resources managed
by GitLab (which is not available when using JIT). These
clusters have been migrated to unmanaged, so resources
can be created on demand for the remaining managed clusters.
Diffstat (limited to 'spec')
7 files changed, 0 insertions, 50 deletions
diff --git a/spec/controllers/projects/clusters_controller_spec.rb b/spec/controllers/projects/clusters_controller_spec.rb index fa49438287f..35cbab57037 100644 --- a/spec/controllers/projects/clusters_controller_spec.rb +++ b/spec/controllers/projects/clusters_controller_spec.rb @@ -340,7 +340,6 @@ describe Projects::ClustersController do describe 'security' do before do - allow(ClusterConfigureWorker).to receive(:perform_async) stub_kubeclient_get_namespace('https://kubernetes.example.com', namespace: 'my-namespace') end @@ -438,7 +437,6 @@ describe Projects::ClustersController do end before do - allow(ClusterConfigureWorker).to receive(:perform_async) stub_kubeclient_get_namespace('https://kubernetes.example.com', namespace: 'my-namespace') end diff --git a/spec/features/projects/clusters/gcp_spec.rb b/spec/features/projects/clusters/gcp_spec.rb index 83e582c34f0..940cada6ea5 100644 --- a/spec/features/projects/clusters/gcp_spec.rb +++ b/spec/features/projects/clusters/gcp_spec.rb @@ -122,7 +122,6 @@ describe 'Gcp Cluster', :js do context 'when user changes cluster parameters' do before do - allow(ClusterConfigureWorker).to receive(:perform_async) fill_in 'cluster_platform_kubernetes_attributes_namespace', with: 'my-namespace' page.within('#js-cluster-details') { click_button 'Save changes' } end diff --git a/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb b/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb index 5ac5122e800..c5bc81a2b9e 100644 --- a/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb +++ b/spec/lib/gitlab/ci/build/prerequisite/kubernetes_namespace_spec.rb @@ -45,12 +45,6 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do it { is_expected.to be_truthy } end end - - context 'and cluster is project type' do - let(:cluster) { create(:cluster, :project) } - - it { is_expected.to be_falsey } - end end context 'and no cluster to deploy to' do diff --git a/spec/models/clusters/platforms/kubernetes_spec.rb b/spec/models/clusters/platforms/kubernetes_spec.rb index 1fb3a8de808..4db2159664a 100644 --- a/spec/models/clusters/platforms/kubernetes_spec.rb +++ b/spec/models/clusters/platforms/kubernetes_spec.rb @@ -510,27 +510,4 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching it { is_expected.to include(pods: []) } end end - - describe '#update_kubernetes_namespace' do - let(:cluster) { create(:cluster, :provided_by_gcp) } - let(:platform) { cluster.platform } - - context 'when namespace is updated' do - it 'calls ConfigureWorker' do - expect(ClusterConfigureWorker).to receive(:perform_async).with(cluster.id).once - - platform.namespace = 'new-namespace' - platform.save - end - end - - context 'when namespace is not updated' do - it 'does not call ConfigureWorker' do - expect(ClusterConfigureWorker).not_to receive(:perform_async) - - platform.username = "new-username" - platform.save - end - end - end end diff --git a/spec/services/clusters/gcp/finalize_creation_service_spec.rb b/spec/services/clusters/gcp/finalize_creation_service_spec.rb index 2664649df47..5f91acb8e84 100644 --- a/spec/services/clusters/gcp/finalize_creation_service_spec.rb +++ b/spec/services/clusters/gcp/finalize_creation_service_spec.rb @@ -19,10 +19,6 @@ describe Clusters::Gcp::FinalizeCreationService, '#execute' do subject { described_class.new.execute(provider) } - before do - allow(ClusterConfigureWorker).to receive(:perform_async) - end - shared_examples 'success' do it 'configures provider and kubernetes' do subject @@ -42,12 +38,6 @@ describe Clusters::Gcp::FinalizeCreationService, '#execute' do expect(platform.password).to eq(password) expect(platform.token).to eq(token) end - - it 'calls ClusterConfigureWorker in a ascync fashion' do - expect(ClusterConfigureWorker).to receive(:perform_async).with(cluster.id) - - subject - end end shared_examples 'error' do diff --git a/spec/services/clusters/update_service_spec.rb b/spec/services/clusters/update_service_spec.rb index 21b37f88fd8..3ee45375dca 100644 --- a/spec/services/clusters/update_service_spec.rb +++ b/spec/services/clusters/update_service_spec.rb @@ -39,7 +39,6 @@ describe Clusters::UpdateService do end before do - allow(ClusterConfigureWorker).to receive(:perform_async) stub_kubeclient_get_namespace('https://kubernetes.example.com', namespace: 'my-namespace') end diff --git a/spec/workers/cluster_provision_worker_spec.rb b/spec/workers/cluster_provision_worker_spec.rb index 9cc2ad12bfc..3f69962f25d 100644 --- a/spec/workers/cluster_provision_worker_spec.rb +++ b/spec/workers/cluster_provision_worker_spec.rb @@ -23,18 +23,11 @@ describe ClusterProvisionWorker do described_class.new.perform(cluster.id) end - - it 'configures kubernetes platform' do - expect(ClusterConfigureWorker).to receive(:perform_async).with(cluster.id) - - described_class.new.perform(cluster.id) - end end context 'when cluster does not exist' do it 'does not provision a cluster' do expect_any_instance_of(Clusters::Gcp::ProvisionService).not_to receive(:execute) - expect(ClusterConfigureWorker).not_to receive(:perform_async) described_class.new.perform(123) end |