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
443d20a4
Commit
443d20a4
authored
May 24, 2020
by
Rajendra Kadam
Committed by
Peter Leitzen
May 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use applogger in project import state
parent
9ed1e151
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
app/models/project_import_state.rb
app/models/project_import_state.rb
+1
-1
changelogs/unreleased/rails-logger-cop-1.yml
changelogs/unreleased/rails-logger-cop-1.yml
+5
-0
spec/models/project_import_state_spec.rb
spec/models/project_import_state_spec.rb
+19
-0
No files found.
app/models/project_import_state.rb
View file @
443d20a4
...
...
@@ -84,7 +84,7 @@ class ProjectImportState < ApplicationRecord
update_column
(
:last_error
,
sanitized_message
)
rescue
ActiveRecord
::
ActiveRecordError
=>
e
Rails
.
logger
.
error
(
"Error setting import status to failed:
#{
e
.
message
}
. Original error:
#{
sanitized_message
}
"
)
# rubocop:disable Gitlab/RailsLogger
Gitlab
::
AppLogger
.
error
(
"Error setting import status to failed:
#{
e
.
message
}
. Original error:
#{
sanitized_message
}
"
)
ensure
@errors
=
original_errors
end
...
...
changelogs/unreleased/rails-logger-cop-1.yml
0 → 100644
View file @
443d20a4
---
title
:
Use applogger in project import state file
merge_request
:
32182
author
:
Rajendra Kadam
type
:
fixed
spec/models/project_import_state_spec.rb
View file @
443d20a4
...
...
@@ -57,6 +57,25 @@ describe ProjectImportState, type: :model do
end
end
describe
'#mark_as_failed'
do
let
(
:error_message
)
{
'some message'
}
it
'logs error when update column fails'
do
allow
(
import_state
).
to
receive
(
:update_column
).
and_raise
(
ActiveRecord
::
ActiveRecordError
)
allow
(
Gitlab
::
AppLogger
).
to
receive
(
:error
)
import_state
.
mark_as_failed
(
error_message
)
expect
(
Gitlab
::
AppLogger
).
to
have_received
(
:error
)
end
it
'updates last_error with error message'
do
import_state
.
mark_as_failed
(
error_message
)
expect
(
import_state
.
last_error
).
to
eq
(
error_message
)
end
end
describe
'#human_status_name'
do
context
'when import_state exists'
do
it
'returns the humanized status name'
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