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
37f656cd
Commit
37f656cd
authored
Mar 16, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for GeoNodeStatusEntity
parent
5a8337a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
0 deletions
+87
-0
spec/serializers/geo_node_status_entity_spec.rb
spec/serializers/geo_node_status_entity_spec.rb
+87
-0
No files found.
spec/serializers/geo_node_status_entity_spec.rb
0 → 100644
View file @
37f656cd
require
'spec_helper'
describe
GeoNodeStatusEntity
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
let
(
:entity
)
do
described_class
.
new
(
geo_node_status
,
request:
double
)
end
let
(
:error
)
do
'Could not connect to Geo database'
end
subject
{
entity
.
as_json
}
it
{
is_expected
.
to
have_key
(
:id
)
}
it
{
is_expected
.
to
have_key
(
:healthy
)
}
it
{
is_expected
.
to
have_key
(
:health
)
}
it
{
is_expected
.
to
have_key
(
:lfs_objects_count
)
}
it
{
is_expected
.
to
have_key
(
:lfs_objects_synced_count
)
}
it
{
is_expected
.
to
have_key
(
:lfs_objects_synced_in_percentage
)
}
it
{
is_expected
.
to
have_key
(
:repositories_count
)
}
it
{
is_expected
.
to
have_key
(
:repositories_failed_count
)
}
it
{
is_expected
.
to
have_key
(
:repositories_synced_count
)}
it
{
is_expected
.
to
have_key
(
:repositories_synced_in_percentage
)
}
describe
'#healthy'
do
context
'when node is healthy'
do
it
'returns true'
do
expect
(
subject
[
:healthy
]).
to
eq
true
end
end
context
'when node is unhealthy'
do
before
do
geo_node_status
.
health
=
error
end
subject
{
entity
.
as_json
}
it
'returns false'
do
expect
(
subject
[
:healthy
]).
to
eq
false
end
end
end
describe
'#health'
do
context
'when node is healthy'
do
it
'exposes the health message'
do
expect
(
subject
[
:health
]).
to
eq
'No Health Problems Detected'
end
end
context
'when node is unhealthy'
do
before
do
geo_node_status
.
health
=
error
end
subject
{
entity
.
as_json
}
it
'exposes the error message'
do
expect
(
subject
[
:health
]).
to
eq
error
end
end
end
describe
'#lfs_objects_synced_in_percentage'
do
it
'formats as percentage'
do
expect
(
subject
[
:lfs_objects_synced_in_percentage
]).
to
eq
'48.05%'
end
end
describe
'#repositories_synced_in_percentage'
do
it
'formats as percentage'
do
expect
(
subject
[
:repositories_synced_in_percentage
]).
to
eq
'50.00%'
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