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
73976d26
Commit
73976d26
authored
Mar 28, 2018
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed unnecessary self. and added some missing specs
parent
dfad296a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
183 additions
and
3 deletions
+183
-3
ee/app/models/geo_node_status.rb
ee/app/models/geo_node_status.rb
+1
-1
ee/spec/factories/geo_node_statuses.rb
ee/spec/factories/geo_node_statuses.rb
+4
-0
ee/spec/factories/project_repository_states.rb
ee/spec/factories/project_repository_states.rb
+2
-2
ee/spec/models/geo_node_status_spec.rb
ee/spec/models/geo_node_status_spec.rb
+176
-0
No files found.
ee/app/models/geo_node_status.rb
View file @
73976d26
...
...
@@ -171,7 +171,7 @@ class GeoNodeStatus < ActiveRecord::Base
end
def
load_verification_data
return
unless
self
.
repository_verification_enabled
return
unless
repository_verification_enabled
finder
=
Gitlab
::
Geo
.
primary?
?
repository_verification_finder
:
projects_finder
self
.
repositories_verified_count
=
finder
.
count_verified_repositories
...
...
ee/spec/factories/geo_node_statuses.rb
View file @
73976d26
...
...
@@ -20,6 +20,10 @@ FactoryBot.define do
wikis_count
9
wikis_synced_count
4
wikis_failed_count
1
repositories_verified_count
501
repositories_verification_failed_count
100
wikis_verified_count
499
wikis_verification_failed_count
99
last_event_id
2
last_event_timestamp
{
Time
.
now
.
to_i
}
cursor_last_event_id
1
...
...
ee/spec/factories/project_repository_states.rb
View file @
73976d26
...
...
@@ -9,12 +9,12 @@ FactoryBot.define do
trait
:repository_outdated
do
repository_verification_checksum
nil
last_repository_verification_failure
false
last_repository_verification_failure
nil
end
trait
:repository_verified
do
repository_verification_checksum
'f079a831cab27bcda7d81cd9b48296d0c3dd92ee'
last_repository_verification_failure
false
last_repository_verification_failure
nil
end
trait
:wiki_failed
do
...
...
ee/spec/models/geo_node_status_spec.rb
View file @
73976d26
...
...
@@ -388,6 +388,182 @@ describe GeoNodeStatus, :geo do
end
end
describe
'#repositories_verified_count'
do
context
'on the primary'
do
before
do
stub_current_geo_node
(
primary
)
end
it
'returns the right number of verified repositories'
do
stub_feature_flags
(
geo_repository_verification:
true
)
create
(
:repository_state
,
:repository_verified
)
create
(
:repository_state
,
:repository_verified
)
expect
(
subject
.
repositories_verified_count
).
to
eq
(
2
)
end
it
'returns existing value when feature flag if off'
do
stub_feature_flags
(
geo_repository_verification:
false
)
create
(
:geo_node_status
,
:healthy
,
geo_node:
primary
)
expect
(
subject
.
repositories_verified_count
).
to
eq
(
501
)
end
end
context
'on the secondary'
do
before
do
stub_current_geo_node
(
secondary
)
end
it
'returns the right number of verified repositories'
do
stub_feature_flags
(
geo_repository_verification:
true
)
create
(
:geo_project_registry
,
:repository_verified
)
create
(
:geo_project_registry
,
:repository_verified
)
expect
(
subject
.
repositories_verified_count
).
to
eq
(
2
)
end
it
'returns existing value when feature flag if off'
do
stub_feature_flags
(
geo_repository_verification:
false
)
create
(
:geo_node_status
,
:healthy
,
geo_node:
secondary
)
expect
(
subject
.
repositories_verified_count
).
to
eq
(
501
)
end
end
end
describe
'#repositories_verification_failed_count'
do
context
'on the primary'
do
before
do
stub_current_geo_node
(
primary
)
end
it
'returns the right number of failed repositories'
do
stub_feature_flags
(
geo_repository_verification:
true
)
create
(
:repository_state
,
:repository_failed
)
create
(
:repository_state
,
:repository_failed
)
expect
(
subject
.
repositories_verification_failed_count
).
to
eq
(
2
)
end
it
'returns existing value when feature flag if off'
do
stub_feature_flags
(
geo_repository_verification:
false
)
create
(
:geo_node_status
,
:healthy
,
geo_node:
primary
)
expect
(
subject
.
repositories_verification_failed_count
).
to
eq
(
100
)
end
end
context
'on the secondary'
do
before
do
stub_current_geo_node
(
secondary
)
end
it
'returns the right number of failed repositories'
do
stub_feature_flags
(
geo_repository_verification:
true
)
create
(
:geo_project_registry
,
:repository_verification_failed
)
create
(
:geo_project_registry
,
:repository_verification_failed
)
expect
(
subject
.
repositories_verification_failed_count
).
to
eq
(
2
)
end
it
'returns existing value when feature flag if off'
do
stub_feature_flags
(
geo_repository_verification:
false
)
create
(
:geo_node_status
,
:healthy
,
geo_node:
secondary
)
expect
(
subject
.
repositories_verification_failed_count
).
to
eq
(
100
)
end
end
end
describe
'#wikis_verified_count'
do
context
'on the primary'
do
before
do
stub_current_geo_node
(
primary
)
end
it
'returns the right number of verified wikis'
do
stub_feature_flags
(
geo_repository_verification:
true
)
create
(
:repository_state
,
:wiki_verified
)
create
(
:repository_state
,
:wiki_verified
)
expect
(
subject
.
wikis_verified_count
).
to
eq
(
2
)
end
it
'returns existing value when feature flag if off'
do
stub_feature_flags
(
geo_repository_verification:
false
)
create
(
:geo_node_status
,
:healthy
,
geo_node:
primary
)
expect
(
subject
.
wikis_verified_count
).
to
eq
(
499
)
end
end
context
'on the secondary'
do
before
do
stub_current_geo_node
(
secondary
)
end
it
'returns the right number of verified wikis'
do
stub_feature_flags
(
geo_repository_verification:
true
)
create
(
:geo_project_registry
,
:wiki_verified
)
create
(
:geo_project_registry
,
:wiki_verified
)
expect
(
subject
.
wikis_verified_count
).
to
eq
(
2
)
end
it
'returns existing value when feature flag if off'
do
stub_feature_flags
(
geo_repository_verification:
false
)
create
(
:geo_node_status
,
:healthy
,
geo_node:
secondary
)
expect
(
subject
.
wikis_verified_count
).
to
eq
(
499
)
end
end
end
describe
'#wikis_verification_failed_count'
do
context
'on the primary'
do
before
do
stub_current_geo_node
(
primary
)
end
it
'returns the right number of failed wikis'
do
stub_feature_flags
(
geo_repository_verification:
true
)
create
(
:repository_state
,
:wiki_failed
)
create
(
:repository_state
,
:wiki_failed
)
expect
(
subject
.
wikis_verification_failed_count
).
to
eq
(
2
)
end
it
'returns existing value when feature flag if off'
do
stub_feature_flags
(
geo_repository_verification:
false
)
create
(
:geo_node_status
,
:healthy
,
geo_node:
primary
)
expect
(
subject
.
wikis_verification_failed_count
).
to
eq
(
99
)
end
end
context
'on the secondary'
do
before
do
stub_current_geo_node
(
secondary
)
end
it
'returns the right number of failed wikis'
do
stub_feature_flags
(
geo_repository_verification:
true
)
create
(
:geo_project_registry
,
:wiki_verification_failed
)
create
(
:geo_project_registry
,
:wiki_verification_failed
)
expect
(
subject
.
wikis_verification_failed_count
).
to
eq
(
2
)
end
it
'returns existing value when feature flag if off'
do
stub_feature_flags
(
geo_repository_verification:
false
)
create
(
:geo_node_status
,
:healthy
,
geo_node:
secondary
)
expect
(
subject
.
wikis_verification_failed_count
).
to
eq
(
99
)
end
end
end
describe
'#last_event_id and #last_event_date'
do
it
'returns nil when no events are available'
do
expect
(
subject
.
last_event_id
).
to
be_nil
...
...
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