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
443a3d8b
Commit
443a3d8b
authored
Aug 25, 2021
by
Mathieu Parent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catch Helm invalid versions
Changelog: fixed
parent
a19ecc2f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
app/workers/packages/helm/extraction_worker.rb
app/workers/packages/helm/extraction_worker.rb
+1
-3
spec/workers/packages/helm/extraction_worker_spec.rb
spec/workers/packages/helm/extraction_worker_spec.rb
+12
-2
No files found.
app/workers/packages/helm/extraction_worker.rb
View file @
443a3d8b
...
@@ -20,9 +20,7 @@ module Packages
...
@@ -20,9 +20,7 @@ module Packages
::
Packages
::
Helm
::
ProcessFileService
.
new
(
channel
,
package_file
).
execute
::
Packages
::
Helm
::
ProcessFileService
.
new
(
channel
,
package_file
).
execute
rescue
::
Packages
::
Helm
::
ExtractFileMetadataService
::
ExtractionError
,
rescue
StandardError
=>
e
::
Packages
::
Helm
::
ProcessFileService
::
ExtractionError
,
::
ActiveModel
::
ValidationError
=>
e
Gitlab
::
ErrorTracking
.
log_exception
(
e
,
project_id:
package_file
.
project_id
)
Gitlab
::
ErrorTracking
.
log_exception
(
e
,
project_id:
package_file
.
project_id
)
package_file
.
package
.
update_column
(
:status
,
:error
)
package_file
.
package
.
update_column
(
:status
,
:error
)
end
end
...
...
spec/workers/packages/helm/extraction_worker_spec.rb
View file @
443a3d8b
...
@@ -23,10 +23,10 @@ RSpec.describe Packages::Helm::ExtractionWorker, type: :worker do
...
@@ -23,10 +23,10 @@ RSpec.describe Packages::Helm::ExtractionWorker, type: :worker do
subject
{
described_class
.
new
.
perform
(
channel
,
package_file_id
)
}
subject
{
described_class
.
new
.
perform
(
channel
,
package_file_id
)
}
shared_examples
'handling error'
do
shared_examples
'handling error'
do
|
error_class
=
Packages
::
Helm
::
ExtractFileMetadataService
::
ExtractionError
|
it
'mark the package as errored'
,
:aggregate_failures
do
it
'mark the package as errored'
,
:aggregate_failures
do
expect
(
Gitlab
::
ErrorTracking
).
to
receive
(
:log_exception
).
with
(
expect
(
Gitlab
::
ErrorTracking
).
to
receive
(
:log_exception
).
with
(
instance_of
(
Packages
::
Helm
::
ExtractFileMetadataService
::
ExtractionError
),
instance_of
(
error_class
),
project_id:
package_file
.
package
.
project_id
project_id:
package_file
.
package
.
project_id
)
)
expect
{
subject
}
expect
{
subject
}
...
@@ -88,5 +88,15 @@ RSpec.describe Packages::Helm::ExtractionWorker, type: :worker do
...
@@ -88,5 +88,15 @@ RSpec.describe Packages::Helm::ExtractionWorker, type: :worker do
it_behaves_like
'handling error'
it_behaves_like
'handling error'
end
end
context
'with an invalid Chart.yaml'
do
before
do
expect_next_instance_of
(
Gem
::
Package
::
TarReader
::
Entry
)
do
|
entry
|
expect
(
entry
).
to
receive
(
:read
).
and_return
(
'{}'
)
end
end
it_behaves_like
'handling error'
,
ActiveRecord
::
RecordInvalid
end
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