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
b6a59cbc
Commit
b6a59cbc
authored
May 20, 2021
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make pending build status explicit in register job specs
parent
d3d793e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
spec/services/ci/register_job_service_spec.rb
spec/services/ci/register_job_service_spec.rb
+16
-16
No files found.
spec/services/ci/register_job_service_spec.rb
View file @
b6a59cbc
...
...
@@ -76,11 +76,11 @@ module Ci
let!
(
:project3
)
{
create
:project
,
shared_runners_enabled:
true
}
let!
(
:pipeline3
)
{
create
:ci_pipeline
,
project:
project3
}
let!
(
:build1_project1
)
{
pending_job
}
let!
(
:build2_project1
)
{
FactoryBot
.
create
:ci_build
,
pipeline:
pipeline
}
let!
(
:build3_project1
)
{
FactoryBot
.
create
:ci_build
,
pipeline:
pipeline
}
let!
(
:build1_project2
)
{
FactoryBot
.
create
:ci_build
,
pipeline:
pipeline2
}
let!
(
:build2_project2
)
{
FactoryBot
.
create
:ci_build
,
pipeline:
pipeline2
}
let!
(
:build1_project3
)
{
FactoryBot
.
create
:ci_build
,
pipeline:
pipeline3
}
let!
(
:build2_project1
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline
)
}
let!
(
:build3_project1
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline
)
}
let!
(
:build1_project2
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline2
)
}
let!
(
:build2_project2
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline2
)
}
let!
(
:build1_project3
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline3
)
}
context
'when using fair scheduling'
do
context
'when all builds are pending'
do
...
...
@@ -237,7 +237,7 @@ module Ci
let!
(
:unrelated_group
)
{
create
(
:group
)
}
let!
(
:unrelated_project
)
{
create
(
:project
,
group_runners_enabled:
true
,
group:
unrelated_group
)
}
let!
(
:unrelated_pipeline
)
{
create
(
:ci_pipeline
,
project:
unrelated_project
)
}
let!
(
:build1_unrelated_project
)
{
create
(
:ci_build
,
pipeline:
unrelated_pipeline
)
}
let!
(
:build1_unrelated_project
)
{
create
(
:ci_build
,
:pending
,
pipeline:
unrelated_pipeline
)
}
let!
(
:unrelated_group_runner
)
{
create
(
:ci_runner
,
:group
,
groups:
[
unrelated_group
])
}
it
'does not consider builds from other group runners'
do
...
...
@@ -318,7 +318,7 @@ module Ci
subject
{
described_class
.
new
(
specific_runner
).
execute
}
context
'with multiple builds are in queue'
do
let!
(
:other_build
)
{
create
:ci_build
,
pipeline:
pipeline
}
let!
(
:other_build
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline
)
}
before
do
allow_any_instance_of
(
Ci
::
RegisterJobService
).
to
receive
(
:builds_for_project_runner
)
...
...
@@ -359,7 +359,7 @@ module Ci
let!
(
:specific_runner
)
{
create
(
:ci_runner
,
:project
,
projects:
[
project
])
}
context
'when a job is protected'
do
let!
(
:pending_job
)
{
create
(
:ci_build
,
:protected
,
pipeline:
pipeline
)
}
let!
(
:pending_job
)
{
create
(
:ci_build
,
:p
ending
,
:p
rotected
,
pipeline:
pipeline
)
}
it
'picks the job'
do
expect
(
execute
(
specific_runner
)).
to
eq
(
pending_job
)
...
...
@@ -367,7 +367,7 @@ module Ci
end
context
'when a job is unprotected'
do
let!
(
:pending_job
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let!
(
:pending_job
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline
)
}
it
'picks the job'
do
expect
(
execute
(
specific_runner
)).
to
eq
(
pending_job
)
...
...
@@ -375,7 +375,7 @@ module Ci
end
context
'when protected attribute of a job is nil'
do
let!
(
:pending_job
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let!
(
:pending_job
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline
)
}
before
do
pending_job
.
update_attribute
(
:protected
,
nil
)
...
...
@@ -391,7 +391,7 @@ module Ci
let!
(
:specific_runner
)
{
create
(
:ci_runner
,
:project
,
:ref_protected
,
projects:
[
project
])
}
context
'when a job is protected'
do
let!
(
:pending_job
)
{
create
(
:ci_build
,
:protected
,
pipeline:
pipeline
)
}
let!
(
:pending_job
)
{
create
(
:ci_build
,
:p
ending
,
:p
rotected
,
pipeline:
pipeline
)
}
it
'picks the job'
do
expect
(
execute
(
specific_runner
)).
to
eq
(
pending_job
)
...
...
@@ -399,7 +399,7 @@ module Ci
end
context
'when a job is unprotected'
do
let!
(
:pending_job
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let!
(
:pending_job
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline
)
}
it
'does not pick the job'
do
expect
(
execute
(
specific_runner
)).
to
be_nil
...
...
@@ -407,7 +407,7 @@ module Ci
end
context
'when protected attribute of a job is nil'
do
let!
(
:pending_job
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let!
(
:pending_job
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline
)
}
before
do
pending_job
.
update_attribute
(
:protected
,
nil
)
...
...
@@ -612,11 +612,11 @@ module Ci
context
'when only some builds can be matched by runner'
do
let!
(
:specific_runner
)
{
create
(
:ci_runner
,
:project
,
projects:
[
project
],
tag_list:
%w[matching]
)
}
let!
(
:pending_job
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
tag_list:
%w[matching]
)
}
let!
(
:pending_job
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline
,
tag_list:
%w[matching]
)
}
before
do
# create additional matching and non-matching jobs
create_list
(
:ci_build
,
2
,
pipeline:
pipeline
,
tag_list:
%w[matching]
)
create_list
(
:ci_build
,
2
,
:pending
,
pipeline:
pipeline
,
tag_list:
%w[matching]
)
create
(
:ci_build
,
pipeline:
pipeline
,
tag_list:
%w[non-matching]
)
end
...
...
@@ -665,7 +665,7 @@ module Ci
end
context
'when there is another build in queue'
do
let!
(
:next_pending_job
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let!
(
:next_pending_job
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline
)
}
it
'skips this build and picks another build'
do
expect
(
Gitlab
::
Ci
::
Queue
::
Metrics
.
queue_operations_total
).
to
receive
(
:increment
)
...
...
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