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
69df47c7
Commit
69df47c7
authored
Sep 02, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve spec
parent
e8e8ae4d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
spec/workers/stuck_ci_jobs_worker_spec.rb
spec/workers/stuck_ci_jobs_worker_spec.rb
+12
-9
No files found.
spec/workers/stuck_ci_jobs_worker_spec.rb
View file @
69df47c7
...
@@ -6,28 +6,31 @@ describe StuckCiJobsWorker do
...
@@ -6,28 +6,31 @@ describe StuckCiJobsWorker do
let
(
:worker
)
{
described_class
.
new
}
let
(
:worker
)
{
described_class
.
new
}
let
(
:exclusive_lease_uuid
)
{
SecureRandom
.
uuid
}
let
(
:exclusive_lease_uuid
)
{
SecureRandom
.
uuid
}
subject
do
job
.
reload
job
.
status
end
before
do
before
do
job
.
update!
(
status:
status
,
updated_at:
updated_at
)
job
.
update!
(
status:
status
,
updated_at:
updated_at
)
allow_any_instance_of
(
Gitlab
::
ExclusiveLease
).
to
receive
(
:try_obtain
).
and_return
(
exclusive_lease_uuid
)
allow_any_instance_of
(
Gitlab
::
ExclusiveLease
).
to
receive
(
:try_obtain
).
and_return
(
exclusive_lease_uuid
)
end
end
shared_examples
'job is dropped'
do
shared_examples
'job is dropped'
do
it
'changes status'
do
before
do
worker
.
perform
worker
.
perform
is_expected
.
to
eq
(
'failed'
)
job
.
reload
end
it
"changes status"
do
expect
(
job
).
to
be_failed
expect
(
job
).
to
be_stuck_or_timeout_failure
expect
(
job
).
to
be_stuck_or_timeout_failure
end
end
end
end
shared_examples
'job is unchanged'
do
shared_examples
'job is unchanged'
do
it
"doesn't change status"
do
before
do
worker
.
perform
worker
.
perform
is_expected
.
to
eq
(
status
)
job
.
reload
end
it
"doesn't change status"
do
expect
(
job
.
status
).
to
eq
(
status
)
end
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