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
83d9d9b4
Commit
83d9d9b4
authored
Nov 29, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add API and spec
parent
e31ff0ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
lib/api/geo_nodes.rb
lib/api/geo_nodes.rb
+26
-0
spec/requests/api/geo_nodes_spec.rb
spec/requests/api/geo_nodes_spec.rb
+21
-0
No files found.
lib/api/geo_nodes.rb
View file @
83d9d9b4
...
...
@@ -77,6 +77,32 @@ module API
present
status
,
with:
::
GeoNodeStatusEntity
end
# Get project registry failures for the current Geo node
#
# Example request:
# GET /geo_nodes/:id/failures/:type
desc
'Get project registry failures for the current Geo node'
do
success
Entities
::
GeoNode
end
params
do
requires
:id
,
type:
Integer
,
desc:
'The ID of the node'
optional
:type
,
type:
String
,
desc:
'Type of failure (repository/wiki)'
use
:pagination
end
get
':id/failures/:type'
do
unless
Gitlab
::
Geo
.
current_node
.
id
==
params
[
:id
]
forbidden!
(
'Geo node is not the current node.'
)
end
geo_node
=
GeoNode
.
find
(
params
[
:id
])
not_found
(
'Geo node not found'
)
unless
geo_node
project_registries
=
geo_node
.
project_registries
present
project_registries
,
with:
::
ProjectRegistryEntity
end
end
end
end
spec/requests/api/geo_nodes_spec.rb
View file @
83d9d9b4
...
...
@@ -86,4 +86,25 @@ describe API::GeoNodes, :geo, api: true do
expect
(
response
.
status
).
to
eq
403
end
end
describe
'GET /geo_nodes/:id/failures/:type'
do
it
'fetches the current node failures'
do
create
(
:geo_project_registry
,
:sync_failed
)
create
(
:geo_project_registry
,
:sync_failed
)
stub_current_geo_node
(
secondary
)
expect
(
GeoNode
).
to
receive
(
:find
).
and_return
(
secondary
)
get
api
(
"/geo_nodes/
#{
secondary
.
id
}
/failures"
,
admin
)
expect
(
response
.
status
).
to
eq
200
expect
(
response
.
body
).
to
eq
(
''
)
end
it
'denies access if not admin'
do
get
api
(
'/geo_nodes'
,
user
)
expect
(
response
.
failures
).
to
eq
403
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