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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
7bb99c21
Commit
7bb99c21
authored
Aug 01, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for unsupported runner
parent
c944e22d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
2 deletions
+107
-2
app/presenters/commit_status_presenter.rb
app/presenters/commit_status_presenter.rb
+1
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+72
-0
spec/presenters/ci/build_presenter_spec.rb
spec/presenters/ci/build_presenter_spec.rb
+1
-1
spec/services/ci/register_job_service_spec.rb
spec/services/ci/register_job_service_spec.rb
+33
-0
No files found.
app/presenters/commit_status_presenter.rb
View file @
7bb99c21
...
@@ -22,6 +22,6 @@ class CommitStatusPresenter < Gitlab::View::Presenter::Delegated
...
@@ -22,6 +22,6 @@ class CommitStatusPresenter < Gitlab::View::Presenter::Delegated
end
end
def
unrecoverable?
def
unrecoverable?
script_failure?
||
missing_dependency_failure?
||
runner_unsupported?
script_failure?
||
missing_dependency_failure?
end
end
end
end
spec/models/ci/build_spec.rb
View file @
7bb99c21
...
@@ -2813,4 +2813,76 @@ describe Ci::Build do
...
@@ -2813,4 +2813,76 @@ describe Ci::Build do
end
end
end
end
end
end
describe
'#publishes_artifacts_reports?'
do
let
(
:build
)
{
create
(
:ci_build
,
options:
options
)
}
subject
{
build
.
publishes_artifacts_reports?
}
context
'when artifacts reports are defined'
do
let
(
:options
)
do
{
artifacts:
{
reports:
{
junit:
"junit.xml"
}
}
}
end
it
{
is_expected
.
to
be_truthy
}
end
context
'when artifacts reports missing defined'
do
let
(
:options
)
do
{
artifacts:
{
paths:
[
"file.txt"
]
}
}
end
it
{
is_expected
.
to
be_falsey
}
end
context
'when options are missing'
do
let
(
:options
)
{
nil
}
it
{
is_expected
.
to
be_falsey
}
end
end
describe
'#runner_required_feature_names'
do
let
(
:build
)
{
create
(
:ci_build
,
options:
options
)
}
subject
{
build
.
runner_required_feature_names
}
context
'when artifacts reports are defined'
do
let
(
:options
)
do
{
artifacts:
{
reports:
{
junit:
"junit.xml"
}
}
}
end
it
{
is_expected
.
to
include
(
:upload_multiple_artifacts
)
}
end
end
describe
'#supported_runner?'
do
set
(
:build
)
{
create
(
:ci_build
)
}
subject
{
build
.
supported_runner?
(
runner_features
)
}
context
'when feature is required by build'
do
before
do
expect
(
build
).
to
receive
(
:runner_required_feature_names
)
do
[
:upload_multiple_artifacts
]
end
end
context
'when runner provides given feature'
do
let
(
:runner_features
)
do
{
upload_multiple_artifacts:
true
}
end
it
{
is_expected
.
to
be_truthy
}
end
context
'when runner does not provide given feature'
do
let
(
:runner_features
)
do
{}
end
it
{
is_expected
.
to
be_falsey
}
end
end
end
end
end
spec/presenters/ci/build_presenter_spec.rb
View file @
7bb99c21
...
@@ -231,7 +231,7 @@ describe Ci::BuildPresenter do
...
@@ -231,7 +231,7 @@ describe Ci::BuildPresenter do
let
(
:build
)
{
create
(
:ci_build
,
:failed
,
:script_failure
)
}
let
(
:build
)
{
create
(
:ci_build
,
:failed
,
:script_failure
)
}
context
'when is a script or missing dependency failure'
do
context
'when is a script or missing dependency failure'
do
let
(
:failure_reasons
)
{
%w(script_failure missing_dependency_failure
runner_unsupported
)
}
let
(
:failure_reasons
)
{
%w(script_failure missing_dependency_failure)
}
it
'should return false'
do
it
'should return false'
do
failure_reasons
.
each
do
|
failure_reason
|
failure_reasons
.
each
do
|
failure_reason
|
...
...
spec/services/ci/register_job_service_spec.rb
View file @
7bb99c21
...
@@ -351,6 +351,38 @@ module Ci
...
@@ -351,6 +351,38 @@ module Ci
end
end
end
end
context
'runner feature set is verified'
do
set
(
:pending_job
)
{
create
(
:ci_build
,
:pending
,
pipeline:
pipeline
)
}
before
do
expect_any_instance_of
(
Ci
::
Build
).
to
receive
(
:runner_required_feature_names
)
do
[
:runner_required_feature
]
end
end
subject
{
execute
(
specific_runner
,
params
)
}
context
'when feature is missing by runner'
do
let
(
:params
)
{
{}
}
it
'does not pick the build and drops the build'
do
expect
(
subject
).
to
be_nil
expect
(
pending_job
.
reload
).
to
be_failed
expect
(
pending_job
).
to
be_runner_unsupported
end
end
context
'when feature is supported by runner'
do
let
(
:params
)
do
{
info:
{
features:
{
runner_required_feature:
true
}
}
}
end
it
'does pick job'
do
expect
(
subject
).
not_to
be_nil
end
end
end
context
'when "dependencies" keyword is specified'
do
context
'when "dependencies" keyword is specified'
do
shared_examples
'not pick'
do
shared_examples
'not pick'
do
it
'does not pick the build and drops the build'
do
it
'does not pick the build and drops the build'
do
...
@@ -403,6 +435,7 @@ module Ci
...
@@ -403,6 +435,7 @@ module Ci
it
{
expect
(
subject
).
to
eq
(
pending_job
)
}
it
{
expect
(
subject
).
to
eq
(
pending_job
)
}
end
end
context
'when artifacts of depended job has been expired'
do
context
'when artifacts of depended job has been expired'
do
let!
(
:pre_stage_job
)
{
create
(
:ci_build
,
:success
,
:expired
,
pipeline:
pipeline
,
name:
'test'
,
stage_idx:
0
)
}
let!
(
:pre_stage_job
)
{
create
(
:ci_build
,
:success
,
:expired
,
pipeline:
pipeline
,
name:
'test'
,
stage_idx:
0
)
}
...
...
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