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
a02ca2af
Commit
a02ca2af
authored
Mar 16, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for GeoNodeStatus
parent
37f656cd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
21 deletions
+83
-21
spec/models/geo/geo_node_status_spec.rb
spec/models/geo/geo_node_status_spec.rb
+0
-21
spec/models/geo_node_status_spec.rb
spec/models/geo_node_status_spec.rb
+83
-0
No files found.
spec/models/geo/geo_node_status_spec.rb
deleted
100644 → 0
View file @
37f656cd
require
'spec_helper'
describe
Geo
::
GeoNodeStatus
,
models:
true
do
subject
{
GeoNodeStatus
.
new
}
describe
'#lfs_objects_synced_in_percentage'
do
it
'returns 0 when no objects are available'
do
subject
.
lfs_objects_total
=
0
subject
.
lfs_objects_synced
=
0
expect
(
subject
.
lfs_objects_synced_in_percentage
).
to
eq
(
0
)
end
it
'returns the right percentage'
do
subject
.
lfs_objects_total
=
4
subject
.
lfs_objects_synced
=
1
expect
(
subject
.
lfs_objects_synced_in_percentage
).
to
be_within
(
0.0001
).
of
(
25
)
end
end
end
spec/models/geo_node_status_spec.rb
0 → 100644
View file @
a02ca2af
require
'spec_helper'
describe
GeoNodeStatus
,
model:
true
do
subject
{
described_class
.
new
}
describe
'#healthy?'
do
context
'when health is blank'
do
it
'returns true'
do
subject
.
health
=
''
expect
(
subject
.
healthy?
).
to
eq
true
end
end
context
'when health is present'
do
it
'returns false'
do
subject
.
health
=
'something went wrong'
expect
(
subject
.
healthy?
).
to
eq
false
end
end
end
describe
'#health'
do
it
'delegates to the HealthCheck'
do
subject
.
health
=
nil
expect
(
HealthCheck
::
Utils
).
to
receive
(
:process_checks
).
with
([
'geo'
]).
once
subject
.
health
end
end
describe
'#lfs_objects_synced_in_percentage'
do
it
'returns 0 when no objects are available'
do
subject
.
lfs_objects_count
=
0
subject
.
lfs_objects_synced_count
=
0
expect
(
subject
.
lfs_objects_synced_in_percentage
).
to
eq
(
0
)
end
it
'returns the right percentage'
do
subject
.
lfs_objects_count
=
4
subject
.
lfs_objects_synced_count
=
1
expect
(
subject
.
lfs_objects_synced_in_percentage
).
to
be_within
(
0.0001
).
of
(
25
)
end
end
describe
'#repositories_synced_in_percentage'
do
it
'returns 0 when no objects are available'
do
subject
.
repositories_count
=
0
subject
.
repositories_synced_count
=
0
expect
(
subject
.
repositories_synced_in_percentage
).
to
eq
(
0
)
end
it
'returns the right percentage'
do
subject
.
repositories_count
=
4
subject
.
repositories_synced_count
=
1
expect
(
subject
.
repositories_synced_in_percentage
).
to
be_within
(
0.0001
).
of
(
25
)
end
end
context
'when no values are available'
do
it
'returns 0 for each attribute'
do
subject
.
lfs_objects_count
=
nil
subject
.
lfs_objects_synced_count
=
nil
subject
.
repositories_count
=
nil
subject
.
repositories_synced_count
=
nil
subject
.
repositories_failed_count
=
nil
expect
(
subject
.
repositories_count
).
to
be_zero
expect
(
subject
.
repositories_synced_count
).
to
be_zero
expect
(
subject
.
repositories_synced_in_percentage
).
to
be_zero
expect
(
subject
.
repositories_failed_count
).
to
be_zero
expect
(
subject
.
lfs_objects_count
).
to
be_zero
expect
(
subject
.
lfs_objects_synced_count
).
to
be_zero
expect
(
subject
.
lfs_objects_synced_in_percentage
).
to
be_zero
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