summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2017-12-03 17:33:38 +0100
committerMatija Čupić <matteeyah@gmail.com>2017-12-03 17:33:38 +0100
commit363c57468dc6f656c6c345f0b9eda32029571201 (patch)
treeb57ac4ad27bed9440948d01c32cc8450aae345ae
parent7691e015d7c103b39a92e3a18f6dff5ff9602394 (diff)
downloadgitlab-ce-363c57468dc6f656c6c345f0b9eda32029571201.tar.gz
Raise error when trying to create second cluster
-rw-r--r--app/services/clusters/create_service.rb2
-rw-r--r--spec/services/clusters/create_service_spec.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/services/clusters/create_service.rb b/app/services/clusters/create_service.rb
index 798c308024b..a47ce5a8887 100644
--- a/app/services/clusters/create_service.rb
+++ b/app/services/clusters/create_service.rb
@@ -5,7 +5,7 @@ module Clusters
def execute(access_token)
@access_token = access_token
- return unless can_create_cluster?
+ raise Exception.new('Instance does not support multiple clusters') unless can_create_cluster?
create_cluster.tap do |cluster|
ClusterProvisionWorker.perform_async(cluster.id) if cluster.persisted?
diff --git a/spec/services/clusters/create_service_spec.rb b/spec/services/clusters/create_service_spec.rb
index 9d31c4c64c6..d758bf6beb2 100644
--- a/spec/services/clusters/create_service_spec.rb
+++ b/spec/services/clusters/create_service_spec.rb
@@ -83,7 +83,7 @@ describe Clusters::CreateService do
it 'does not create a cluster' do
expect(ClusterProvisionWorker).not_to receive(:perform_async)
- expect { result }.to change { Clusters::Cluster.count }.by(0)
+ expect { result }.to raise_error(Exception).and change { Clusters::Cluster.count }.by(0)
end
end
end