summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2018-09-08 01:32:31 +1200
committerThong Kuah <tkuah@gitlab.com>2018-09-14 16:26:51 +1200
commit292d2208e093658bbbd95a0d36c7e40b62cc271c (patch)
treecadba6077fc2f17ce775f8fed88087bd339d7c4e /spec
parenta02e35308b97d43964ebcf7fda040da418c04ddc (diff)
downloadgitlab-ce-292d2208e093658bbbd95a0d36c7e40b62cc271c.tar.gz
Add FE option for users to choose to create a fully RBAC-enabled cluster or not.
This is similar to the option in the Add Existing cluster form
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/clusters_controller_spec.rb16
-rw-r--r--spec/support/services/clusters/create_service_shared.rb13
2 files changed, 17 insertions, 12 deletions
diff --git a/spec/controllers/projects/clusters_controller_spec.rb b/spec/controllers/projects/clusters_controller_spec.rb
index 26a532ee01d..97ac11fd171 100644
--- a/spec/controllers/projects/clusters_controller_spec.rb
+++ b/spec/controllers/projects/clusters_controller_spec.rb
@@ -170,12 +170,14 @@ describe Projects::ClustersController do
end
describe 'POST create for new cluster' do
+ let(:legacy_abac_param) { 'true' }
let(:params) do
{
cluster: {
name: 'new-cluster',
provider_gcp_attributes: {
- gcp_project_id: 'gcp-project-12345'
+ gcp_project_id: 'gcp-project-12345',
+ legacy_abac: legacy_abac_param
}
}
}
@@ -201,6 +203,18 @@ describe Projects::ClustersController do
expect(response).to redirect_to(project_cluster_path(project, project.clusters.first))
expect(project.clusters.first).to be_gcp
expect(project.clusters.first).to be_kubernetes
+ expect(project.clusters.first.provider_gcp).to be_legacy_abac
+ end
+
+ context 'when legacy_abac param is false' do
+ let(:legacy_abac_param) { 'false' }
+
+ it 'creates a new cluster with legacy_abac_disabled' do
+ expect(ClusterProvisionWorker).to receive(:perform_async)
+ expect { go }.to change { Clusters::Cluster.count }
+ .and change { Clusters::Providers::Gcp.count }
+ expect(project.clusters.first.provider_gcp).not_to be_legacy_abac
+ end
end
end
diff --git a/spec/support/services/clusters/create_service_shared.rb b/spec/support/services/clusters/create_service_shared.rb
index b45ad3f6b8c..e2b5920d794 100644
--- a/spec/support/services/clusters/create_service_shared.rb
+++ b/spec/support/services/clusters/create_service_shared.rb
@@ -7,7 +7,8 @@ shared_context 'valid cluster create params' do
gcp_project_id: 'gcp-project',
zone: 'us-central1-a',
num_nodes: 1,
- machine_type: 'machine_type-a'
+ machine_type: 'machine_type-a',
+ legacy_abac: 'true'
}
}
end
@@ -50,16 +51,6 @@ shared_examples 'create cluster service success' do
expect(subject.provider).to be_legacy_abac
expect(subject.platform).to be_nil
end
-
- context 'rbac_clusters feature is enabled' do
- before do
- stub_feature_flags(rbac_clusters: true)
- end
-
- it 'has legacy_abac false' do
- expect(subject.provider).not_to be_legacy_abac
- end
- end
end
shared_examples 'create cluster service error' do