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
cd23850e
Commit
cd23850e
authored
Dec 06, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests
parent
6171db2d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
28 deletions
+32
-28
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+27
-17
spec/services/ci/register_job_service_spec.rb
spec/services/ci/register_job_service_spec.rb
+5
-11
No files found.
spec/models/ci/build_spec.rb
View file @
cd23850e
...
...
@@ -1891,11 +1891,7 @@ describe Ci::Build do
let
(
:options
)
{
{
dependencies:
[
'test'
]
}
}
context
'when a depended job exists'
do
let!
(
:pre_stage_job
)
{
create
(
:ci_build
,
:success
,
pipeline:
pipeline
,
name:
'test'
,
stage_idx:
0
)
}
it
{
expect
{
build
.
run!
}.
not_to
raise_error
}
context
'when "artifacts" keyword is specified on depended job'
do
context
'when depended job has artifacts'
do
let!
(
:pre_stage_job
)
do
create
(
:ci_build
,
:success
,
...
...
@@ -1906,22 +1902,36 @@ describe Ci::Build do
options:
{
artifacts:
{
paths:
[
'binaries/'
]
}
}
)
end
context
'when artifacts of depended job has existsed'
do
it
{
expect
{
build
.
run!
}.
not_to
raise_error
}
end
it
{
expect
{
build
.
run!
}.
not_to
raise_error
}
end
context
'when artifacts of depended job has not existsed'
do
before
do
pre_stage_job
.
erase_artifacts!
end
context
'when depended job does not have artifacts'
do
let!
(
:pre_stage_job
)
{
create
(
:ci_build
,
:success
,
pipeline:
pipeline
,
name:
'test'
,
stage_idx:
0
)
}
it
{
expect
{
build
.
run!
}.
to
raise_error
(
Ci
::
Build
::
MissingDependenciesError
)
}
end
it
{
expect
{
build
.
run!
}.
not_to
raise_error
}
end
end
context
'when depended jobs do not exist'
do
it
{
expect
{
build
.
run!
}.
to
raise_error
(
Ci
::
Build
::
MissingDependenciesError
)
}
context
'when depended job has not been completed yet'
do
let!
(
:pre_stage_job
)
{
create
(
:ci_build
,
:running
,
pipeline:
pipeline
,
name:
'test'
,
stage_idx:
0
)
}
it
{
expect
{
build
.
run!
}.
to
raise_error
(
Ci
::
Build
::
MissingDependenciesError
)
}
end
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
)
}
it
{
expect
{
build
.
run!
}.
to
raise_error
(
Ci
::
Build
::
MissingDependenciesError
)
}
end
context
'when artifacts of depended job has been erased'
do
let!
(
:pre_stage_job
)
{
create
(
:ci_build
,
:success
,
pipeline:
pipeline
,
name:
'test'
,
stage_idx:
0
,
erased_at:
1
.
minute
.
ago
)
}
before
do
pre_stage_job
.
erase
end
it
{
expect
{
build
.
run!
}.
to
raise_error
(
Ci
::
Build
::
MissingDependenciesError
)
}
end
end
end
end
...
...
spec/services/ci/register_job_service_spec.rb
View file @
cd23850e
...
...
@@ -277,6 +277,10 @@ module Ci
end
context
'when "dependencies" keyword is specified'
do
before
do
stub_feature_flags
(
ci_validates_dependencies:
true
)
end
let!
(
:pre_stage_job
)
{
create
(
:ci_build
,
:success
,
pipeline:
pipeline
,
name:
job_name
,
stage_idx:
0
)
}
let!
(
:pending_job
)
do
...
...
@@ -311,7 +315,7 @@ module Ci
context
'when artifacts of depended job has not existsed'
do
before
do
pre_stage_job
.
erase
_artifacts!
pre_stage_job
.
erase
end
it
'does not pick the build and drops the build'
do
...
...
@@ -322,16 +326,6 @@ module Ci
end
end
end
context
'when depended jobs do not exist'
do
let
(
:job_name
)
{
'robocop'
}
it
'does not pick the build and drops the build'
do
expect
(
picked_job
).
to
be_nil
expect
(
pending_job
.
reload
).
to
be_failed
expect
(
pending_job
).
to
be_missing_dependency_failure
end
end
end
def
execute
(
runner
)
...
...
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