summaryrefslogtreecommitdiff
path: root/spec/controllers/admin
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-26 09:08:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-26 09:08:36 +0000
commit23d237110e6a646dec08e1f5b4696d2d9c51cfef (patch)
tree3c568514c8e22203f50d38940cbb9865aad5bb02 /spec/controllers/admin
parent274dff4f027da636f62361c811285cbb5d5a7c0c (diff)
downloadgitlab-ce-23d237110e6a646dec08e1f5b4696d2d9c51cfef.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/admin')
-rw-r--r--spec/controllers/admin/clusters_controller_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/controllers/admin/clusters_controller_spec.rb b/spec/controllers/admin/clusters_controller_spec.rb
index ebae931764d..326d0808092 100644
--- a/spec/controllers/admin/clusters_controller_spec.rb
+++ b/spec/controllers/admin/clusters_controller_spec.rb
@@ -448,6 +448,33 @@ describe Admin::ClustersController do
end
end
+ describe 'DELETE clear cluster cache' do
+ let(:cluster) { create(:cluster, :instance) }
+ let!(:kubernetes_namespace) do
+ create(:cluster_kubernetes_namespace,
+ cluster: cluster,
+ project: create(:project)
+ )
+ end
+
+ def go
+ delete :clear_cache, params: { id: cluster }
+ end
+
+ it 'deletes the namespaces associated with the cluster' do
+ expect { go }.to change { Clusters::KubernetesNamespace.count }
+
+ expect(response).to redirect_to(admin_cluster_path(cluster))
+ expect(cluster.kubernetes_namespaces).to be_empty
+ end
+
+ describe 'security' do
+ it { expect { go }.to be_allowed_for(:admin) }
+ it { expect { go }.to be_denied_for(:user) }
+ it { expect { go }.to be_denied_for(:external) }
+ end
+ end
+
describe 'GET #cluster_status' do
let(:cluster) { create(:cluster, :providing_by_gcp, :instance) }