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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
dc62441f
Commit
dc62441f
authored
Nov 24, 2017
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport EE changes to make test possible when prepending modules
parent
05876a49
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
6 deletions
+18
-6
app/services/projects/hashed_storage/migrate_attachments_service.rb
...es/projects/hashed_storage/migrate_attachments_service.rb
+4
-0
app/services/projects/hashed_storage/migrate_repository_service.rb
...ces/projects/hashed_storage/migrate_repository_service.rb
+4
-0
spec/services/projects/hashed_storage_migration_service_spec.rb
...ervices/projects/hashed_storage_migration_service_spec.rb
+10
-6
No files found.
app/services/projects/hashed_storage/migrate_attachments_service.rb
View file @
dc62441f
...
@@ -17,6 +17,10 @@ module Projects
...
@@ -17,6 +17,10 @@ module Projects
move_folder!
(
old_path
,
new_path
)
move_folder!
(
old_path
,
new_path
)
project
.
save!
project
.
save!
if
block_given?
yield
end
end
end
private
private
...
...
app/services/projects/hashed_storage/migrate_repository_service.rb
View file @
dc62441f
...
@@ -35,6 +35,10 @@ module Projects
...
@@ -35,6 +35,10 @@ module Projects
project
.
repository_read_only
=
false
project
.
repository_read_only
=
false
project
.
save!
project
.
save!
if
result
&&
block_given?
yield
end
result
result
end
end
...
...
spec/services/projects/hashed_storage_migration_service_spec.rb
View file @
dc62441f
...
@@ -6,32 +6,36 @@ describe Projects::HashedStorageMigrationService do
...
@@ -6,32 +6,36 @@ describe Projects::HashedStorageMigrationService do
describe
'#execute'
do
describe
'#execute'
do
context
'repository migration'
do
context
'repository migration'
do
let
(
:repository_service
)
{
Projects
::
HashedStorage
::
MigrateRepositoryService
.
new
(
project
,
subject
.
logger
)
}
it
'delegates migration to Projects::HashedStorage::MigrateRepositoryService'
do
it
'delegates migration to Projects::HashedStorage::MigrateRepositoryService'
do
expect
(
Projects
::
HashedStorage
::
MigrateRepositoryService
).
to
receive
(
:new
).
with
(
project
,
subject
.
logger
).
and_
call_original
expect
(
Projects
::
HashedStorage
::
MigrateRepositoryService
).
to
receive
(
:new
).
with
(
project
,
subject
.
logger
).
and_
return
(
repository_service
)
expect
_any_instance_of
(
Projects
::
HashedStorage
::
MigrateRepositoryS
ervice
).
to
receive
(
:execute
)
expect
(
repository_s
ervice
).
to
receive
(
:execute
)
service
.
execute
service
.
execute
end
end
it
'does not delegate migration if repository is already migrated'
do
it
'does not delegate migration if repository is already migrated'
do
project
.
storage_version
=
::
Project
::
LATEST_STORAGE_VERSION
project
.
storage_version
=
::
Project
::
LATEST_STORAGE_VERSION
expect
_any_instance_of
(
Projects
::
HashedStorage
::
MigrateRepositoryService
).
not_to
receive
(
:execute
)
expect
(
Projects
::
HashedStorage
::
MigrateRepositoryService
).
not_to
receive
(
:new
)
service
.
execute
service
.
execute
end
end
end
end
context
'attachments migration'
do
context
'attachments migration'
do
let
(
:attachments_service
)
{
Projects
::
HashedStorage
::
MigrateAttachmentsService
.
new
(
project
,
subject
.
logger
)
}
it
'delegates migration to Projects::HashedStorage::MigrateRepositoryService'
do
it
'delegates migration to Projects::HashedStorage::MigrateRepositoryService'
do
expect
(
Projects
::
HashedStorage
::
MigrateAttachmentsService
).
to
receive
(
:new
).
with
(
project
,
subject
.
logger
).
and_
call_original
expect
(
Projects
::
HashedStorage
::
MigrateAttachmentsService
).
to
receive
(
:new
).
with
(
project
,
subject
.
logger
).
and_
return
(
attachments_service
)
expect
_any_instance_of
(
Projects
::
HashedStorage
::
MigrateAttachmentsS
ervice
).
to
receive
(
:execute
)
expect
(
attachments_s
ervice
).
to
receive
(
:execute
)
service
.
execute
service
.
execute
end
end
it
'does not delegate migration if attachments are already migrated'
do
it
'does not delegate migration if attachments are already migrated'
do
project
.
storage_version
=
::
Project
::
LATEST_STORAGE_VERSION
project
.
storage_version
=
::
Project
::
LATEST_STORAGE_VERSION
expect
_any_instance_of
(
Projects
::
HashedStorage
::
MigrateAttachmentsService
).
not_to
receive
(
:execute
)
expect
(
Projects
::
HashedStorage
::
MigrateAttachmentsService
).
not_to
receive
(
:new
)
service
.
execute
service
.
execute
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