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
9bb27f79
Commit
9bb27f79
authored
Nov 21, 2018
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store the last time the repository have been verified
parent
7f94acec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
3 deletions
+25
-3
ee/app/models/project_repository_state.rb
ee/app/models/project_repository_state.rb
+0
-2
ee/app/services/geo/repository_verification_primary_service.rb
...p/services/geo/repository_verification_primary_service.rb
+1
-0
ee/spec/services/geo/repository_verification_primary_service_spec.rb
...vices/geo/repository_verification_primary_service_spec.rb
+24
-1
No files found.
ee/app/models/project_repository_state.rb
View file @
9bb27f79
...
...
@@ -4,9 +4,7 @@ class ProjectRepositoryState < ActiveRecord::Base
include
IgnorableColumn
include
ShaAttribute
ignore_column
:last_repository_verification_at
ignore_column
:last_repository_verification_failed
ignore_column
:last_wiki_verification_at
ignore_column
:last_wiki_verification_failed
sha_attribute
:repository_verification_checksum
...
...
ee/app/services/geo/repository_verification_primary_service.rb
View file @
9bb27f79
...
...
@@ -33,6 +33,7 @@ module Geo
repository_state
.
update!
(
"
#{
type
}
_verification_checksum"
=>
checksum
,
"last_
#{
type
}
_verification_ran_at"
=>
Time
.
now
,
"last_
#{
type
}
_verification_failure"
=>
failure
,
"
#{
type
}
_retry_at"
=>
retry_at
,
"
#{
type
}
_retry_count"
=>
retry_count
...
...
ee/spec/services/geo/repository_verification_primary_service_spec.rb
View file @
9bb27f79
...
...
@@ -18,8 +18,10 @@ describe Geo::RepositoryVerificationPrimaryService do
expect
(
project
.
repository_state
).
to
have_attributes
(
repository_verification_checksum:
'f123'
,
last_repository_verification_ran_at:
be_present
,
last_repository_verification_failure:
nil
,
wiki_verification_checksum:
'e321'
,
last_wiki_verification_ran_at:
be_present
,
last_wiki_verification_failure:
nil
,
repository_retry_at:
nil
,
repository_retry_count:
nil
,
...
...
@@ -42,8 +44,10 @@ describe Geo::RepositoryVerificationPrimaryService do
expect
(
repository_state
.
reload
).
to
have_attributes
(
repository_verification_checksum:
'f123'
,
last_repository_verification_ran_at:
be_present
,
last_repository_verification_failure:
nil
,
wiki_verification_checksum:
'e321'
,
last_wiki_verification_ran_at:
be_present
,
last_wiki_verification_failure:
nil
,
repository_retry_at:
nil
,
repository_retry_count:
nil
,
...
...
@@ -66,8 +70,10 @@ describe Geo::RepositoryVerificationPrimaryService do
expect
(
repository_state
.
reload
).
to
have_attributes
(
repository_verification_checksum:
'f123'
,
last_repository_verification_ran_at:
be_present
,
last_repository_verification_failure:
nil
,
wiki_verification_checksum:
'e321'
,
last_wiki_verification_ran_at:
be_present
,
last_wiki_verification_failure:
nil
,
repository_retry_at:
nil
,
repository_retry_count:
nil
,
...
...
@@ -83,12 +89,19 @@ describe Geo::RepositoryVerificationPrimaryService do
create
(
:repository_state
,
project:
project
,
repository_verification_checksum:
'f079a831cab27bcda7d81cd9b48296d0c3dd92ee'
,
wiki_verification_checksum:
'e079a831cab27bcda7d81cd9b48296d0c3dd92ef'
)
last_repository_verification_ran_at:
1
.
day
.
ago
,
wiki_verification_checksum:
'e079a831cab27bcda7d81cd9b48296d0c3dd92ef'
,
last_wiki_verification_ran_at:
1
.
day
.
ago
)
expect
(
repository
).
to
receive
(
:checksum
)
expect
(
wiki
).
to
receive
(
:checksum
)
subject
.
execute
expect
(
project
.
repository_state
).
to
have_attributes
(
last_repository_verification_ran_at:
be_within
(
100
.
seconds
).
of
(
Time
.
now
),
last_wiki_verification_ran_at:
be_within
(
100
.
seconds
).
of
(
Time
.
now
)
)
end
it
'calculates the wiki checksum even when wiki is not enabled for project'
do
...
...
@@ -101,8 +114,10 @@ describe Geo::RepositoryVerificationPrimaryService do
expect
(
project
.
repository_state
).
to
have_attributes
(
repository_verification_checksum:
'f123'
,
last_repository_verification_ran_at:
be_present
,
last_repository_verification_failure:
nil
,
wiki_verification_checksum:
'e321'
,
last_wiki_verification_ran_at:
be_present
,
last_wiki_verification_failure:
nil
,
repository_retry_at:
nil
,
repository_retry_count:
nil
,
...
...
@@ -116,8 +131,10 @@ describe Geo::RepositoryVerificationPrimaryService do
expect
(
project
.
repository_state
).
to
have_attributes
(
repository_verification_checksum:
'0000000000000000000000000000000000000000'
,
last_repository_verification_ran_at:
be_present
,
last_repository_verification_failure:
nil
,
wiki_verification_checksum:
'0000000000000000000000000000000000000000'
,
last_wiki_verification_ran_at:
be_present
,
last_wiki_verification_failure:
nil
,
repository_retry_at:
nil
,
repository_retry_count:
nil
,
...
...
@@ -134,8 +151,10 @@ describe Geo::RepositoryVerificationPrimaryService do
expect
(
project_broken_repo
.
repository_state
).
to
have_attributes
(
repository_verification_checksum:
'0000000000000000000000000000000000000000'
,
last_repository_verification_ran_at:
be_present
,
last_repository_verification_failure:
nil
,
wiki_verification_checksum:
'0000000000000000000000000000000000000000'
,
last_wiki_verification_ran_at:
be_present
,
last_wiki_verification_failure:
nil
,
repository_retry_at:
nil
,
repository_retry_count:
nil
,
...
...
@@ -176,8 +195,10 @@ describe Geo::RepositoryVerificationPrimaryService do
expect
(
project
.
repository_state
).
to
have_attributes
(
repository_verification_checksum:
nil
,
last_repository_verification_ran_at:
be_present
,
last_repository_verification_failure:
'Something went wrong with repository'
,
wiki_verification_checksum:
nil
,
last_wiki_verification_ran_at:
be_present
,
last_wiki_verification_failure:
'Something went wrong with wiki'
,
repository_retry_at:
be_present
,
repository_retry_count:
1
,
...
...
@@ -197,8 +218,10 @@ describe Geo::RepositoryVerificationPrimaryService do
expect
(
repository_state
.
reload
).
to
have_attributes
(
repository_verification_checksum:
nil
,
last_repository_verification_ran_at:
be_present
,
last_repository_verification_failure:
'Something went wrong with repository'
,
wiki_verification_checksum:
nil
,
last_wiki_verification_ran_at:
be_present
,
last_wiki_verification_failure:
'Something went wrong with wiki'
,
repository_retry_at:
be_within
(
100
.
seconds
).
of
(
Time
.
now
+
7
.
days
),
repository_retry_count:
31
,
...
...
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