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
f9bd2d7a
Commit
f9bd2d7a
authored
Sep 14, 2021
by
Mike Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo: Alternate redownload and normal design sync attempts
Changelog: changed EE: true
parent
bc6c2a5c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
17 deletions
+20
-17
ee/app/models/geo/design_registry.rb
ee/app/models/geo/design_registry.rb
+1
-1
ee/spec/models/geo/design_registry_spec.rb
ee/spec/models/geo/design_registry_spec.rb
+19
-16
No files found.
ee/app/models/geo/design_registry.rb
View file @
f9bd2d7a
...
...
@@ -120,6 +120,6 @@ class Geo::DesignRegistry < Geo::BaseRegistry
def
should_be_redownloaded?
return
true
if
force_to_redownload
retry_count
>
RETRIES_BEFORE_REDOWNLOAD
retry_count
.
present?
&&
retry_count
>
RETRIES_BEFORE_REDOWNLOAD
&&
retry_count
.
odd?
end
end
ee/spec/models/geo/design_registry_spec.rb
View file @
f9bd2d7a
...
...
@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec
.
describe
Geo
::
DesignRegistry
,
:geo
do
include
::
EE
::
GeoHelpers
using
RSpec
::
Parameterized
::
TableSyntax
it_behaves_like
'a BulkInsertSafe model'
,
Geo
::
DesignRegistry
do
let
(
:valid_items_for_bulk_insertion
)
do
...
...
@@ -266,25 +267,27 @@ RSpec.describe Geo::DesignRegistry, :geo do
end
describe
'#should_be_redownloaded?'
do
let_it_be
(
:design_registry
)
{
create
(
:geo_design_registry
)
}
context
'when force_to_redownload is false'
do
it
'returns false'
do
expect
(
design_registry
.
should_be_redownloaded?
).
to
be
false
end
it
'returns true when limit is exceeded'
do
design_registry
.
retry_count
=
Geo
::
DesignRegistry
::
RETRIES_BEFORE_REDOWNLOAD
+
1
expect
(
design_registry
.
should_be_redownloaded?
).
to
be
true
end
end
context
'when force_to_redownload is true'
do
it
'resets the state of the sync'
do
design_registry
.
force_to_redownload
=
true
expect
(
design_registry
.
should_be_redownloaded?
).
to
be
true
where
(
:force_to_redownload
,
:retry_count
,
:expected
)
do
false
|
nil
|
false
false
|
0
|
false
false
|
1
|
false
false
|
10
|
false
false
|
11
|
true
false
|
12
|
false
false
|
13
|
true
false
|
14
|
false
false
|
101
|
true
false
|
102
|
false
true
|
nil
|
true
true
|
0
|
true
true
|
11
|
true
end
with_them
do
it
"returns the expected boolean"
do
registry
=
build
(
:geo_design_registry
,
retry_count:
retry_count
,
force_to_redownload:
force_to_redownload
)
expect
(
registry
.
should_be_redownloaded?
).
to
eq
(
expected
)
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