diff options
author | Thong Kuah <tkuah@gitlab.com> | 2018-09-06 10:03:38 +0000 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2018-09-06 10:03:38 +0000 |
commit | 6f2ad2b6041b8a007df7eb8c4f477c24cc153ac3 (patch) | |
tree | 7b190f17b6da295cf3599174f48c0fbc060ddbb1 /spec/controllers/projects/clusters_controller_spec.rb | |
parent | a2ea32dd44cc4a104e404325c73a77151913a946 (diff) | |
download | gitlab-ce-6f2ad2b6041b8a007df7eb8c4f477c24cc153ac3.tar.gz |
Enable Kubernetes RBAC for GitLab Managed Apps for existing clusters
Diffstat (limited to 'spec/controllers/projects/clusters_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/clusters_controller_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/controllers/projects/clusters_controller_spec.rb b/spec/controllers/projects/clusters_controller_spec.rb index 42917d0d505..26a532ee01d 100644 --- a/spec/controllers/projects/clusters_controller_spec.rb +++ b/spec/controllers/projects/clusters_controller_spec.rb @@ -274,11 +274,43 @@ describe Projects::ClustersController do context 'when creates a cluster' do it 'creates a new cluster' do expect(ClusterProvisionWorker).to receive(:perform_async) + expect { go }.to change { Clusters::Cluster.count } .and change { Clusters::Platforms::Kubernetes.count } + expect(response).to redirect_to(project_cluster_path(project, project.clusters.first)) + + expect(project.clusters.first).to be_user + expect(project.clusters.first).to be_kubernetes + end + end + + context 'when creates a RBAC-enabled cluster' do + let(:params) do + { + cluster: { + name: 'new-cluster', + platform_kubernetes_attributes: { + api_url: 'http://my-url', + token: 'test', + namespace: 'aaa', + authorization_type: 'rbac' + } + } + } + end + + it 'creates a new cluster' do + expect(ClusterProvisionWorker).to receive(:perform_async) + + expect { go }.to change { Clusters::Cluster.count } + .and change { Clusters::Platforms::Kubernetes.count } + + expect(response).to redirect_to(project_cluster_path(project, project.clusters.first)) + expect(project.clusters.first).to be_user expect(project.clusters.first).to be_kubernetes + expect(project.clusters.first).to be_platform_kubernetes_rbac end end end |