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
665dfc9f
Commit
665dfc9f
authored
Mar 06, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Toon: Cleanup unused routes
parent
2ce42edf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
194 deletions
+0
-194
ee/app/controllers/admin/geo_nodes_controller.rb
ee/app/controllers/admin/geo_nodes_controller.rb
+0
-44
ee/spec/controllers/admin/geo_nodes_controller_spec.rb
ee/spec/controllers/admin/geo_nodes_controller_spec.rb
+0
-150
No files found.
ee/app/controllers/admin/geo_nodes_controller.rb
View file @
665dfc9f
...
...
@@ -37,50 +37,6 @@ class Admin::GeoNodesController < Admin::ApplicationController
end
end
def
destroy
@node
.
destroy
redirect_to
admin_geo_nodes_path
,
status:
302
,
notice:
'Node was successfully removed.'
end
def
repair
if
!
@node
.
missing_oauth_application?
flash
[
:notice
]
=
"This node doesn't need to be repaired."
elsif
@node
.
repair
flash
[
:notice
]
=
'Node Authentication was successfully repaired.'
else
flash
[
:alert
]
=
'There was a problem repairing Node Authentication.'
end
redirect_to
admin_geo_nodes_path
end
def
toggle
if
@node
.
primary?
flash
[
:alert
]
=
"Primary node can't be disabled."
else
if
@node
.
toggle!
(
:enabled
)
new_status
=
@node
.
enabled?
?
'enabled'
:
'disabled'
flash
[
:notice
]
=
"Node
#{
@node
.
url
}
was successfully
#{
new_status
}
."
else
action
=
@node
.
enabled?
?
'disabling'
:
'enabling'
flash
[
:alert
]
=
"There was a problem
#{
action
}
node
#{
@node
.
url
}
."
end
end
redirect_to
admin_geo_nodes_path
end
def
status
status
=
Geo
::
NodeStatusFetchService
.
new
.
call
(
@node
)
respond_to
do
|
format
|
format
.
json
do
render
json:
GeoNodeStatusSerializer
.
new
.
represent
(
status
)
end
end
end
private
def
geo_node_params
...
...
ee/spec/controllers/admin/geo_nodes_controller_spec.rb
View file @
665dfc9f
...
...
@@ -55,34 +55,6 @@ describe Admin::GeoNodesController, :postgresql do
end
end
describe
'#destroy'
do
let!
(
:geo_node
)
{
create
(
:geo_node
)
}
def
go
delete
(
:destroy
,
id:
geo_node
)
end
context
'without add-on license'
do
before
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:license_allows?
).
and_return
(
false
)
end
it
'deletes the node'
do
expect
{
go
}.
to
change
{
GeoNode
.
count
}.
by
(
-
1
)
end
end
context
'with add-on license'
do
before
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:license_allows?
).
and_return
(
true
)
end
it
'deletes the node'
do
expect
{
go
}.
to
change
{
GeoNode
.
count
}.
by
(
-
1
)
end
end
end
describe
'#create'
do
let
(
:geo_node_attributes
)
{
{
url:
'http://example.com'
}
}
...
...
@@ -149,126 +121,4 @@ describe Admin::GeoNodesController, :postgresql do
end
end
end
describe
'#repair'
do
let
(
:geo_node
)
{
create
(
:geo_node
)
}
def
go
post
:repair
,
id:
geo_node
end
before
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:license_allows?
)
{
false
}
go
end
it_behaves_like
'unlicensed geo action'
end
describe
'#toggle'
do
context
'without add-on license'
do
let
(
:geo_node
)
{
create
(
:geo_node
)
}
before
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:license_allows?
).
and_return
(
false
)
post
:toggle
,
id:
geo_node
end
it_behaves_like
'unlicensed geo action'
end
context
'with add-on license'
do
before
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:license_allows?
).
and_return
(
true
)
end
context
'with a primary node'
do
before
do
post
:toggle
,
id:
geo_node
end
let
(
:geo_node
)
{
create
(
:geo_node
,
:primary
,
enabled:
true
)
}
it
'does not disable the node'
do
expect
(
geo_node
.
reload
).
to
be_enabled
end
it
'displays a flash message'
do
expect
(
controller
).
to
set_flash
[
:alert
].
to
(
"Primary node can't be disabled."
)
end
it
'redirects to the geo nodes page'
do
expect
(
response
).
to
redirect_to
(
admin_geo_nodes_path
)
end
end
context
'with a secondary node'
do
let
(
:geo_node
)
{
create
(
:geo_node
,
url:
'http://example.com'
)
}
context
'when succeed'
do
before
do
post
:toggle
,
id:
geo_node
end
it
'disables the node'
do
expect
(
geo_node
.
reload
).
not_to
be_enabled
end
it
'displays a flash message'
do
expect
(
controller
).
to
set_flash
[
:notice
].
to
(
'Node http://example.com/ was successfully disabled.'
)
end
it
'redirects to the geo nodes page'
do
expect
(
response
).
to
redirect_to
(
admin_geo_nodes_path
)
end
end
context
'when fail'
do
before
do
allow_any_instance_of
(
GeoNode
).
to
receive
(
:toggle!
).
and_return
(
false
)
post
:toggle
,
id:
geo_node
end
it
'does not disable the node'
do
expect
(
geo_node
.
reload
).
to
be_enabled
end
it
'displays a flash message'
do
expect
(
controller
).
to
set_flash
[
:alert
].
to
(
'There was a problem disabling node http://example.com/.'
)
end
it
'redirects to the geo nodes page'
do
expect
(
response
).
to
redirect_to
(
admin_geo_nodes_path
)
end
end
end
end
end
describe
'#status'
do
let
(
:geo_node
)
{
create
(
:geo_node
)
}
context
'without add-on license'
do
before
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:license_allows?
).
and_return
(
false
)
get
:status
,
id:
geo_node
,
format: :json
end
it_behaves_like
'unlicensed geo action'
end
context
'with add-on license'
do
let
(
:geo_node_status
)
{
build
(
:geo_node_status
,
:healthy
,
geo_node:
geo_node
)
}
before
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:license_allows?
).
and_return
(
true
)
allow_any_instance_of
(
Geo
::
NodeStatusFetchService
).
to
receive
(
:call
).
and_return
(
geo_node_status
)
end
it
'returns the status'
do
get
:status
,
id:
geo_node
,
format: :json
expect
(
response
).
to
match_response_schema
(
'public_api/v4/geo_node_status'
,
dir:
'ee'
)
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