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
c2a6a581
Commit
c2a6a581
authored
Dec 02, 2020
by
George Koltsov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Truncate error messages for failed Group Import
parent
83b25c71
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
app/models/group_import_state.rb
app/models/group_import_state.rb
+3
-1
changelogs/unreleased/georgekoltsov-truncate-last-error-group-import.yml
...leased/georgekoltsov-truncate-last-error-group-import.yml
+5
-0
spec/models/group_import_state_spec.rb
spec/models/group_import_state_spec.rb
+20
-0
No files found.
app/models/group_import_state.rb
View file @
c2a6a581
...
...
@@ -3,6 +3,8 @@
class
GroupImportState
<
ApplicationRecord
self
.
primary_key
=
:group_id
MAX_ERROR_LENGTH
=
255
belongs_to
:group
,
inverse_of: :import_state
belongs_to
:user
,
optional:
false
...
...
@@ -30,7 +32,7 @@ class GroupImportState < ApplicationRecord
after_transition
any
=>
:failed
do
|
state
,
transition
|
last_error
=
transition
.
args
.
first
state
.
update_column
(
:last_error
,
last_error
)
if
last_error
state
.
update_column
(
:last_error
,
last_error
.
truncate
(
MAX_ERROR_LENGTH
)
)
if
last_error
end
end
...
...
changelogs/unreleased/georgekoltsov-truncate-last-error-group-import.yml
0 → 100644
View file @
c2a6a581
---
title
:
Fix failed group imports getting stuck by long error messages
merge_request
:
48989
author
:
type
:
fixed
spec/models/group_import_state_spec.rb
View file @
c2a6a581
...
...
@@ -70,4 +70,24 @@ RSpec.describe GroupImportState do
end
end
end
context
'when import failed'
do
context
'when error message is present'
do
it
'truncates error message'
do
group_import_state
=
build
(
:group_import_state
,
:started
)
group_import_state
.
fail_op
(
'e'
*
300
)
expect
(
group_import_state
.
last_error
.
length
).
to
eq
(
255
)
end
end
context
'when error message is missing'
do
it
'has no error message'
do
group_import_state
=
build
(
:group_import_state
,
:started
)
group_import_state
.
fail_op
expect
(
group_import_state
.
last_error
).
to
be_nil
end
end
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