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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d8ad9572
Commit
d8ad9572
authored
Oct 30, 2019
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow management_project_id to be unset
Add test showing the bug.
parent
145953c9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
app/services/clusters/update_service.rb
app/services/clusters/update_service.rb
+1
-1
spec/services/clusters/update_service_spec.rb
spec/services/clusters/update_service_spec.rb
+17
-0
No files found.
app/services/clusters/update_service.rb
View file @
d8ad9572
...
@@ -23,7 +23,7 @@ module Clusters
...
@@ -23,7 +23,7 @@ module Clusters
end
end
def
validate_params
(
cluster
)
def
validate_params
(
cluster
)
if
params
[
:management_project_id
]
if
params
[
:management_project_id
]
.
present?
management_project
=
management_project_scope
(
cluster
).
find_by_id
(
params
[
:management_project_id
])
management_project
=
management_project_scope
(
cluster
).
find_by_id
(
params
[
:management_project_id
])
unless
management_project
unless
management_project
...
...
spec/services/clusters/update_service_spec.rb
View file @
d8ad9572
...
@@ -138,6 +138,23 @@ describe Clusters::UpdateService do
...
@@ -138,6 +138,23 @@ describe Clusters::UpdateService do
expect
(
cluster
.
management_project_id
).
to
be_nil
expect
(
cluster
.
management_project_id
).
to
be_nil
end
end
end
end
context
'cluster already has a management project set'
do
before
do
cluster
.
update!
(
management_project:
create
(
:project
))
end
let
(
:params
)
do
{
management_project_id:
''
}
end
it
'unsets management_project_id'
do
is_expected
.
to
eq
(
true
)
cluster
.
reload
expect
(
cluster
.
management_project_id
).
to
be_nil
end
end
end
end
context
'project cluster'
do
context
'project cluster'
do
...
...
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