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
e5253c6f
Commit
e5253c6f
authored
Mar 16, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for the status action of GeoNodesController
parent
a02ca2af
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
0 deletions
+65
-0
spec/controllers/admin/geo_nodes_controller_spec.rb
spec/controllers/admin/geo_nodes_controller_spec.rb
+37
-0
spec/fixtures/api/schemas/geo_node_status.json
spec/fixtures/api/schemas/geo_node_status.json
+28
-0
No files found.
spec/controllers/admin/geo_nodes_controller_spec.rb
View file @
e5253c6f
...
...
@@ -195,4 +195,41 @@ describe Admin::GeoNodesController do
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
)
do
GeoNodeStatus
.
new
(
id:
1
,
health:
nil
,
lfs_objects_count:
256
,
lfs_objects_synced_count:
123
,
repositories_count:
10
,
repositories_synced_count:
5
)
end
before
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:license_allows?
).
and_return
(
true
)
allow_any_instance_of
(
Geo
::
NodeStatusService
).
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
(
'geo_node_status'
)
end
end
end
end
spec/fixtures/api/schemas/geo_node_status.json
0 → 100644
View file @
e5253c6f
{
"type"
:
"object"
,
"required"
:
[
"id"
,
"healthy"
,
"health"
,
"lfs_objects_count"
,
"lfs_objects_synced_count"
,
"lfs_objects_synced_in_percentage"
,
"repositories_count"
,
"repositories_failed_count"
,
"repositories_synced_count"
,
"repositories_synced_in_percentage"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"healthy"
:
{
"type"
:
"boolean"
},
"health"
:
{
"type"
:
"string"
},
"lfs_objects_count"
:
{
"type"
:
"integer"
},
"lfs_objects_synced_count"
:
{
"type"
:
"integer"
},
"lfs_objects_synced_in_percentage"
:
{
"type"
:
"string"
},
"repositories_count"
:
{
"type"
:
"integer"
},
"repositories_failed_count"
:
{
"type"
:
"integer"
},
"repositories_synced_count"
:
{
"type"
:
"integer"
},
"repositories_synced_in_percentage"
:
{
"type"
:
"string"
}
},
"additionalProperties"
:
false
}
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