Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
363c5746
Commit
363c5746
authored
Dec 03, 2017
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise error when trying to create second cluster
parent
7691e015
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
app/services/clusters/create_service.rb
app/services/clusters/create_service.rb
+1
-1
spec/services/clusters/create_service_spec.rb
spec/services/clusters/create_service_spec.rb
+1
-1
No files found.
app/services/clusters/create_service.rb
View file @
363c5746
...
@@ -5,7 +5,7 @@ module Clusters
...
@@ -5,7 +5,7 @@ module Clusters
def
execute
(
access_token
)
def
execute
(
access_token
)
@access_token
=
access_token
@access_token
=
access_token
r
eturn
unless
can_create_cluster?
r
aise
Exception
.
new
(
'Instance does not support multiple clusters'
)
unless
can_create_cluster?
create_cluster
.
tap
do
|
cluster
|
create_cluster
.
tap
do
|
cluster
|
ClusterProvisionWorker
.
perform_async
(
cluster
.
id
)
if
cluster
.
persisted?
ClusterProvisionWorker
.
perform_async
(
cluster
.
id
)
if
cluster
.
persisted?
...
...
spec/services/clusters/create_service_spec.rb
View file @
363c5746
...
@@ -83,7 +83,7 @@ describe Clusters::CreateService do
...
@@ -83,7 +83,7 @@ describe Clusters::CreateService do
it
'does not create a cluster'
do
it
'does not create a cluster'
do
expect
(
ClusterProvisionWorker
).
not_to
receive
(
:perform_async
)
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
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment