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
47111001
Commit
47111001
authored
Nov 22, 2018
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always run CleanUp before writing the git config
parent
4908e4b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
17 deletions
+20
-17
lib/gitlab/background_migration/backfill_project_fullpath_in_repo_config.rb
...und_migration/backfill_project_fullpath_in_repo_config.rb
+2
-1
spec/lib/gitlab/background_migration/backfill_project_fullpath_in_repo_config_spec.rb
...igration/backfill_project_fullpath_in_repo_config_spec.rb
+6
-2
spec/migrations/backfill_store_project_full_path_in_repo_spec.rb
...grations/backfill_store_project_full_path_in_repo_spec.rb
+12
-14
No files found.
lib/gitlab/background_migration/backfill_project_fullpath_in_repo_config.rb
View file @
47111001
...
@@ -144,7 +144,6 @@ module Gitlab
...
@@ -144,7 +144,6 @@ module Gitlab
return
unless
project
return
unless
project
project
.
cleanup_repository
migration_class
.
new
.
safe_perform_one
(
project
,
retry_count
)
migration_class
.
new
.
safe_perform_one
(
project
,
retry_count
)
end
end
end
end
...
@@ -178,6 +177,7 @@ module Gitlab
...
@@ -178,6 +177,7 @@ module Gitlab
end
end
def
perform_one
(
project
)
def
perform_one
(
project
)
project
.
cleanup_repository
project
.
add_fullpath_config
project
.
add_fullpath_config
end
end
end
end
...
@@ -192,6 +192,7 @@ module Gitlab
...
@@ -192,6 +192,7 @@ module Gitlab
end
end
def
perform_one
(
project
)
def
perform_one
(
project
)
project
.
cleanup_repository
project
.
remove_fullpath_config
project
.
remove_fullpath_config
end
end
end
end
...
...
spec/lib/gitlab/background_migration/backfill_project_fullpath_in_repo_config_spec.rb
View file @
47111001
...
@@ -46,10 +46,12 @@ describe Gitlab::BackgroundMigration::BackfillProjectFullpathInRepoConfig, :migr
...
@@ -46,10 +46,12 @@ describe Gitlab::BackgroundMigration::BackfillProjectFullpathInRepoConfig, :migr
projects
.
create!
(
namespace_id:
subgroup
.
id
,
name:
'buzz'
,
path:
'buzz'
,
storage_version:
1
)
projects
.
create!
(
namespace_id:
subgroup
.
id
,
name:
'buzz'
,
path:
'buzz'
,
storage_version:
1
)
expect_next_instance_of
(
Gitlab
::
GitalyClient
::
RepositoryService
)
do
|
repository_service
|
expect_next_instance_of
(
Gitlab
::
GitalyClient
::
RepositoryService
)
do
|
repository_service
|
allow
(
repository_service
).
to
receive
(
:cleanup
)
expect
(
repository_service
).
to
receive
(
:set_config
).
with
(
'gitlab.fullpath'
=>
'foo/bar/baz'
)
expect
(
repository_service
).
to
receive
(
:set_config
).
with
(
'gitlab.fullpath'
=>
'foo/bar/baz'
)
end
end
expect_next_instance_of
(
Gitlab
::
GitalyClient
::
RepositoryService
)
do
|
repository_service
|
expect_next_instance_of
(
Gitlab
::
GitalyClient
::
RepositoryService
)
do
|
repository_service
|
allow
(
repository_service
).
to
receive
(
:cleanup
)
expect
(
repository_service
).
to
receive
(
:set_config
).
with
(
'gitlab.fullpath'
=>
'foo/bar/buzz'
)
expect
(
repository_service
).
to
receive
(
:set_config
).
with
(
'gitlab.fullpath'
=>
'foo/bar/buzz'
)
end
end
...
@@ -65,8 +67,10 @@ describe Gitlab::BackgroundMigration::BackfillProjectFullpathInRepoConfig, :migr
...
@@ -65,8 +67,10 @@ describe Gitlab::BackgroundMigration::BackfillProjectFullpathInRepoConfig, :migr
it
'asks the gitaly client to set config'
do
it
'asks the gitaly client to set config'
do
projects
.
create!
(
namespace_id:
subgroup
.
id
,
name:
'baz'
,
path:
'baz'
)
projects
.
create!
(
namespace_id:
subgroup
.
id
,
name:
'baz'
,
path:
'baz'
)
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
RepositoryService
)
expect_next_instance_of
(
Gitlab
::
GitalyClient
::
RepositoryService
)
do
|
repository_service
|
.
to
receive
(
:delete_config
).
with
([
'gitlab.fullpath'
])
allow
(
repository_service
).
to
receive
(
:cleanup
)
expect
(
repository_service
).
to
receive
(
:delete_config
).
with
([
'gitlab.fullpath'
])
end
migrate
migrate
end
end
...
...
spec/migrations/backfill_store_project_full_path_in_repo_spec.rb
View file @
47111001
...
@@ -20,21 +20,19 @@ describe BackfillStoreProjectFullPathInRepo, :migration do
...
@@ -20,21 +20,19 @@ describe BackfillStoreProjectFullPathInRepo, :migration do
describe
'#up'
do
describe
'#up'
do
shared_examples_for
'writes the full path to git config'
do
shared_examples_for
'writes the full path to git config'
do
let
(
:repository_service
)
{
spy
(
:repository_service
)
}
def
stub_repository_service
allow
(
Gitlab
::
GitalyClient
::
RepositoryService
).
to
receive
(
:new
).
and_return
(
repository_service
)
end
it
'writes the git config'
do
it
'writes the git config'
do
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
RepositoryService
)
expect_next_instance_of
(
Gitlab
::
GitalyClient
::
RepositoryService
)
do
|
repository_service
|
.
to
receive
(
:set_config
).
with
(
'gitlab.fullpath'
=>
expected_path
)
allow
(
repository_service
).
to
receive
(
:cleanup
)
expect
(
repository_service
).
to
receive
(
:set_config
).
with
(
'gitlab.fullpath'
=>
expected_path
)
end
migration
.
up
migration
.
up
end
end
it
'retries in case of failure'
do
it
'retries in case of failure'
do
stub_repository_service
repository_service
=
spy
(
:repository_service
)
allow
(
Gitlab
::
GitalyClient
::
RepositoryService
).
to
receive
(
:new
).
and_return
(
repository_service
)
allow
(
repository_service
).
to
receive
(
:set_config
).
and_raise
(
GRPC
::
BadStatus
,
'Retry me'
)
allow
(
repository_service
).
to
receive
(
:set_config
).
and_raise
(
GRPC
::
BadStatus
,
'Retry me'
)
expect
(
repository_service
).
to
receive
(
:set_config
).
exactly
(
3
).
times
expect
(
repository_service
).
to
receive
(
:set_config
).
exactly
(
3
).
times
...
@@ -42,11 +40,11 @@ describe BackfillStoreProjectFullPathInRepo, :migration do
...
@@ -42,11 +40,11 @@ describe BackfillStoreProjectFullPathInRepo, :migration do
migration
.
up
migration
.
up
end
end
it
'cleans up repository
in case of failure
'
do
it
'cleans up repository
before writing the config
'
do
stub_repository_service
expect_next_instance_of
(
Gitlab
::
GitalyClient
::
RepositoryService
)
do
|
repository_service
|
expect
(
repository_service
).
to
receive
(
:cleanup
).
ordered
allow
(
repository_service
).
to
receive
(
:set_config
).
and_raise
(
GRPC
::
BadStatus
,
'Retry me'
)
expect
(
repository_service
).
to
receive
(
:set_config
).
ordered
e
xpect
(
repository_service
).
to
receive
(
:cleanup
)
e
nd
migration
.
up
migration
.
up
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