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
69849ff2
Commit
69849ff2
authored
Jan 24, 2019
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track when MigrateAttachmentsService is skipped
We need this new state for the Geo event logic in EE
parent
02ad6e26
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
app/services/projects/hashed_storage/migrate_attachments_service.rb
...es/projects/hashed_storage/migrate_attachments_service.rb
+6
-0
spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb
...ojects/hashed_storage/migrate_attachments_service_spec.rb
+12
-2
No files found.
app/services/projects/hashed_storage/migrate_attachments_service.rb
View file @
69849ff2
...
...
@@ -14,6 +14,7 @@ module Projects
@logger
=
logger
||
Rails
.
logger
@old_disk_path
=
old_disk_path
@new_disk_path
=
project
.
disk_path
@skipped
=
false
end
def
execute
...
...
@@ -34,11 +35,16 @@ module Projects
result
end
def
skipped?
@skipped
end
private
def
move_folder!
(
old_path
,
new_path
)
unless
File
.
directory?
(
old_path
)
logger
.
info
(
"Skipped attachments migration from '
#{
old_path
}
' to '
#{
new_path
}
', source path doesn't exist or is not a directory (PROJECT_ID=
#{
project
.
id
}
)"
)
@skipped
=
true
return
true
end
...
...
spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb
View file @
69849ff2
...
...
@@ -32,6 +32,12 @@ describe Projects::HashedStorage::MigrateAttachmentsService do
it
'returns true'
do
expect
(
service
.
execute
).
to
be_truthy
end
it
'sets skipped to false'
do
service
.
execute
expect
(
service
.
skipped?
).
to
be_falsey
end
end
context
'when original folder does not exist anymore'
do
...
...
@@ -49,10 +55,14 @@ describe Projects::HashedStorage::MigrateAttachmentsService do
end
it
'returns true'
do
expect
(
FileUtils
).
not_to
receive
(
:mv
).
with
(
base_path
(
legacy_storage
),
base_path
(
hashed_storage
))
expect
(
service
.
execute
).
to
be_truthy
end
it
'sets skipped to true'
do
service
.
execute
expect
(
service
.
skipped?
).
to
be_truthy
end
end
context
'when target folder already exists'
do
...
...
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