summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2019-01-11 10:46:41 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2019-01-11 10:46:41 +0000
commitb98f6e53f6fa97ef1166fb2da95909c79894fd28 (patch)
treeff78bc726876b8e68cad59d58272499ba35a1ef2 /spec
parentb682a6f8981d303e7ee7ecc4273768ee6ed66864 (diff)
parent8b2fe985ddf29a490fef0fc2b76d6a6ac2d566fd (diff)
downloadgitlab-ce-b98f6e53f6fa97ef1166fb2da95909c79894fd28.tar.gz
Merge branch '56110-cluster-kubernetes-api-500-error-on-post-request' into 'master'
Improves restriction of multiple Kubernetes clusters via API Closes #56110 See merge request gitlab-org/gitlab-ce!24251
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/project_clusters_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/requests/api/project_clusters_spec.rb b/spec/requests/api/project_clusters_spec.rb
index e34164aa66a..9bab1f95150 100644
--- a/spec/requests/api/project_clusters_spec.rb
+++ b/spec/requests/api/project_clusters_spec.rb
@@ -266,6 +266,23 @@ describe API::ProjectClusters do
end
end
end
+
+ context 'when user tries to add multiple clusters' do
+ before do
+ create(:cluster, :provided_by_gcp, :project,
+ projects: [project])
+
+ post api("/projects/#{project.id}/clusters/user", current_user), params: cluster_params
+ end
+
+ it 'should respond with 403' do
+ expect(response).to have_gitlab_http_status(403)
+ end
+
+ it 'should return an appropriate message' do
+ expect(json_response['message']).to include('Instance does not support multiple Kubernetes clusters')
+ end
+ end
end
describe 'PUT /projects/:id/clusters/:cluster_id' do