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
d59510b4
Commit
d59510b4
authored
May 10, 2021
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix update_root_ref with inmemory feature disabled
parent
da05f79b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
30 deletions
+96
-30
ee/app/services/geo/repository_sync_service.rb
ee/app/services/geo/repository_sync_service.rb
+2
-2
ee/spec/services/geo/repository_sync_service_spec.rb
ee/spec/services/geo/repository_sync_service_spec.rb
+94
-28
No files found.
ee/app/services/geo/repository_sync_service.rb
View file @
d59510b4
...
...
@@ -57,8 +57,8 @@ module Geo
project
.
update_root_ref
(
GEO_REMOTE_NAME
,
remote_url
,
authorization
)
else
repository
_
with_config
(
jwt_authentication_header
)
do
project
.
update_root_ref
(
GEO_REMOTE_NAME
,
remote_url
)
repository
.
with_config
(
jwt_authentication_header
)
do
project
.
update_root_ref
(
GEO_REMOTE_NAME
,
remote_url
,
nil
)
end
end
end
...
...
ee/spec/services/geo/repository_sync_service_spec.rb
View file @
d59510b4
...
...
@@ -233,53 +233,119 @@ RSpec.describe Geo::RepositorySyncService, :geo do
context
'with non empty repositories'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
context
'w
hen when HEAD change
'
do
context
'w
ith inmemory feature disabled
'
do
before
do
allow
(
project
.
repository
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
'geo'
,
url_to_repo
,
anything
)
.
and_return
(
'feature'
)
stub_feature_flags
(
find_remote_root_refs_inmemory:
false
)
end
it
'syncs gitattributes to info/attributes'
do
expect
(
repository
).
to
receive
(
:copy_gitattributes
)
context
'when HEAD change'
do
before
do
allow
(
project
.
repository
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
'geo'
,
url_to_repo
,
nil
)
.
and_return
(
'feature'
)
end
subject
.
execute
it
'syncs gitattributes to info/attributes'
do
expect
(
repository
).
to
receive
(
:copy_gitattributes
)
subject
.
execute
end
it
'updates the default branch with JWT credentials'
do
expect
(
repository
).
to
receive
(
:with_config
)
.
with
(
"http.
#{
url_to_repo
}
.extraHeader"
=>
anything
)
.
and_call_original
.
twice
expect
(
project
).
to
receive
(
:change_head
).
with
(
'feature'
).
once
subject
.
execute
end
end
it
'updates the default branch with JWT credentials'
do
expect
(
repository
).
to
receive
(
:with_config
)
.
with
(
"http.
#{
url_to_repo
}
.extraHeader"
=>
anything
)
.
and_call_original
context
'when HEAD does not change'
do
before
do
allow
(
project
.
repository
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
'geo'
,
url_to_repo
,
nil
)
.
and_return
(
project
.
default_branch
)
end
it
'syncs gitattributes to info/attributes'
do
expect
(
repository
).
to
receive
(
:copy_gitattributes
)
subject
.
execute
end
it
'updates the default branch with JWT credentials'
do
expect
(
repository
).
to
receive
(
:with_config
)
.
with
(
"http.
#{
url_to_repo
}
.extraHeader"
=>
anything
)
.
and_call_original
.
twice
expect
(
project
).
to
receive
(
:change_head
).
with
(
'feature
'
).
once
expect
(
project
).
to
receive
(
:change_head
).
with
(
'master
'
).
once
subject
.
execute
subject
.
execute
end
end
end
context
'w
hen HEAD does not change
'
do
context
'w
ith inmemory feature enabled
'
do
before
do
allow
(
project
.
repository
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
'geo'
,
url_to_repo
,
anything
)
.
and_return
(
project
.
default_branch
)
stub_feature_flags
(
find_remote_root_refs_inmemory:
true
)
end
it
'syncs gitattributes to info/attributes'
do
expect
(
repository
).
to
receive
(
:copy_gitattributes
)
context
'when HEAD change'
do
before
do
allow
(
project
.
repository
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
'geo'
,
url_to_repo
,
anything
)
.
and_return
(
'feature'
)
end
subject
.
execute
it
'syncs gitattributes to info/attributes'
do
expect
(
repository
).
to
receive
(
:copy_gitattributes
)
subject
.
execute
end
it
'updates the default branch'
do
expect
(
repository
).
to
receive
(
:with_config
)
.
with
(
"http.
#{
url_to_repo
}
.extraHeader"
=>
anything
)
.
and_call_original
.
once
expect
(
project
).
to
receive
(
:change_head
).
with
(
'feature'
).
once
subject
.
execute
end
end
it
'updates the default branch with JWT credentials'
do
expect
(
repository
).
to
receive
(
:with_config
)
.
with
(
"http.
#{
url_to_repo
}
.extraHeader"
=>
anything
)
.
and_call_original
context
'when HEAD does not change'
do
before
do
allow
(
project
.
repository
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
'geo'
,
url_to_repo
,
anything
)
.
and_return
(
project
.
default_branch
)
end
it
'syncs gitattributes to info/attributes'
do
expect
(
repository
).
to
receive
(
:copy_gitattributes
)
subject
.
execute
end
it
'updates the default branch'
do
expect
(
repository
).
to
receive
(
:with_config
)
.
with
(
"http.
#{
url_to_repo
}
.extraHeader"
=>
anything
)
.
and_call_original
.
once
expect
(
project
).
to
receive
(
:change_head
).
with
(
'master'
).
once
expect
(
project
).
to
receive
(
:change_head
).
with
(
'master'
).
once
subject
.
execute
subject
.
execute
end
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