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
1c4b9e9d
Commit
1c4b9e9d
authored
Oct 07, 2021
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No-op BuildFinishedWorker for deleted and pending_delete projects
parent
16910b84
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
6 deletions
+32
-6
app/workers/ci/build_finished_worker.rb
app/workers/ci/build_finished_worker.rb
+5
-5
spec/workers/build_finished_worker_spec.rb
spec/workers/build_finished_worker_spec.rb
+27
-1
No files found.
app/workers/ci/build_finished_worker.rb
View file @
1c4b9e9d
...
@@ -15,13 +15,13 @@ module Ci
...
@@ -15,13 +15,13 @@ module Ci
ARCHIVE_TRACES_IN
=
2
.
minutes
.
freeze
ARCHIVE_TRACES_IN
=
2
.
minutes
.
freeze
# rubocop: disable CodeReuse/ActiveRecord
def
perform
(
build_id
)
def
perform
(
build_id
)
Ci
::
Build
.
find_by
(
id:
build_id
).
try
do
|
build
|
return
unless
build
=
Ci
::
Build
.
find_by
(
id:
build_id
)
# rubocop: disable CodeReuse/ActiveRecord
return
unless
build
.
project
return
if
build
.
project
.
pending_delete?
process_build
(
build
)
process_build
(
build
)
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
private
private
...
...
spec/workers/build_finished_worker_spec.rb
View file @
1c4b9e9d
...
@@ -3,7 +3,9 @@
...
@@ -3,7 +3,9 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
BuildFinishedWorker
do
RSpec
.
describe
BuildFinishedWorker
do
subject
{
described_class
.
new
.
perform
(
build
.
id
)
}
let
(
:worker
)
{
described_class
.
new
}
subject
{
worker
.
perform
(
build
.
id
)
}
describe
'#perform'
do
describe
'#perform'
do
context
'when build exists'
do
context
'when build exists'
do
...
@@ -63,6 +65,30 @@ RSpec.describe BuildFinishedWorker do
...
@@ -63,6 +65,30 @@ RSpec.describe BuildFinishedWorker do
subject
subject
end
end
end
end
context
'when project is deleted'
do
before
do
allow
(
build
).
to
receive
(
:project
).
and_return
(
nil
)
end
it
'does no processing'
do
expect
(
worker
).
not_to
receive
(
:process_build
)
subject
end
end
context
'when project is pending_delete'
do
before
do
build
.
project
.
update_attribute
(
:pending_delete
,
true
)
end
it
'does no processing'
do
expect
(
worker
).
not_to
receive
(
:process_build
)
subject
end
end
end
end
context
'when build does not exist'
do
context
'when build does not exist'
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