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
bba593dd
Commit
bba593dd
authored
Feb 06, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix outputs
parent
cbd09793
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
ee/app/workers/object_storage/migrate_uploads_worker.rb
ee/app/workers/object_storage/migrate_uploads_worker.rb
+6
-4
spec/ee/spec/workers/object_storage/migrate_uploads_worker_spec.rb
...pec/workers/object_storage/migrate_uploads_worker_spec.rb
+2
-2
No files found.
ee/app/workers/object_storage/migrate_uploads_worker.rb
View file @
bba593dd
...
...
@@ -99,6 +99,10 @@ module ObjectStorage
def
success?
error
.
nil?
end
def
to_s
success?
?
"Migration successful."
:
"Error while migrating
#{
upload
.
id
}
:
#{
error
.
message
}
"
end
end
module
Report
...
...
@@ -124,13 +128,11 @@ module ObjectStorage
end
def
header
(
success
,
failures
)
color
=
failures
.
count
==
0
?
:green
:
:red
"Migrated
#{
success
.
count
}
/
#{
success
.
count
+
failures
.
count
}
files."
.
color
(
color
)
"Migrated
#{
success
.
count
}
/
#{
success
.
count
+
failures
.
count
}
files."
end
def
failures
(
failures
)
failures
.
map
{
|
f
|
"
\t
#{
f
}
"
.
color
(
:red
)
}.
join
(
'\n'
)
failures
.
map
{
|
f
|
"
\t
#{
f
}
"
}.
join
(
'\n'
)
end
end
...
...
spec/ee/spec/workers/object_storage/migrate_uploads_worker_spec.rb
View file @
bba593dd
...
...
@@ -78,7 +78,7 @@ describe ObjectStorage::MigrateUploadsWorker, :sidekiq do
shared_examples
'outputs correctly'
do
|
success:
0
,
failures:
0
|
total
=
success
+
failures
if
success
if
success
>
0
it
'outputs the reports'
do
expect
(
Rails
.
logger
).
to
receive
(
:info
).
with
(
%r{Migrated
#{
success
}
/
#{
total
}
files}
)
...
...
@@ -86,7 +86,7 @@ describe ObjectStorage::MigrateUploadsWorker, :sidekiq do
end
end
if
failures
if
failures
>
0
it
'outputs upload failures'
do
expect
(
Rails
.
logger
).
to
receive
(
:warn
).
with
(
/Error .* I am a teapot/
)
...
...
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