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
783bd2b7
Commit
783bd2b7
authored
Nov 25, 2021
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs to verify CI services run after commit
parent
0f030f83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
spec/models/user_spec.rb
spec/models/user_spec.rb
+21
-5
No files found.
spec/models/user_spec.rb
View file @
783bd2b7
...
...
@@ -1856,15 +1856,31 @@ RSpec.describe User do
end
context
'when user has running CI pipelines'
do
let
(
:service
)
{
double
}
let
(
:pipelines
)
{
build_list
(
:ci_pipeline
,
3
,
:running
)
}
it
'aborts all running pipelines and related jobs'
do
it
'drops all running pipelines and related jobs'
do
drop_service
=
double
disable_service
=
double
expect
(
user
).
to
receive
(
:pipelines
).
and_return
(
pipelines
)
expect
(
Ci
::
DropPipelineService
).
to
receive
(
:new
).
and_return
(
service
)
expect
(
service
).
to
receive
(
:execute_async_for_all
).
with
(
pipelines
,
:user_blocked
,
user
)
expect
(
Ci
::
DropPipelineService
).
to
receive
(
:new
).
and_return
(
drop_
service
)
expect
(
drop_
service
).
to
receive
(
:execute_async_for_all
).
with
(
pipelines
,
:user_blocked
,
user
)
user
.
block
expect
(
Ci
::
DisableUserPipelineSchedulesService
).
to
receive
(
:new
).
and_return
(
disable_service
)
expect
(
disable_service
).
to
receive
(
:execute
).
with
(
user
)
user
.
block!
end
it
'does not drop running pipelines if the transaction rolls back'
do
expect
(
Ci
::
DropPipelineService
).
not_to
receive
(
:new
)
expect
(
Ci
::
DisableUserPipelineSchedulesService
).
not_to
receive
(
:new
)
User
.
transaction
do
user
.
block
raise
ActiveRecord
::
Rollback
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