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
Boxiang Sun
gitlab-ce
Commits
4b458ca7
Commit
4b458ca7
authored
May 23, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests
parent
d5e073a4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
spec/workers/rescue_stale_live_trace_worker_spec.rb
spec/workers/rescue_stale_live_trace_worker_spec.rb
+71
-0
No files found.
spec/workers/rescue_stale_live_trace_worker_spec.rb
0 → 100644
View file @
4b458ca7
require
'spec_helper'
describe
RescueStaleLiveTraceWorker
do
subject
{
described_class
.
new
.
perform
}
before
do
stub_feature_flags
(
ci_enable_live_trace:
true
)
end
shared_examples_for
'schedules to archive traces'
do
it
do
expect
(
ArchiveTraceWorker
).
to
receive
(
:bulk_perform_async
).
with
([[
build
.
id
]])
subject
end
end
shared_examples_for
'does not schedule to archive traces'
do
it
do
expect
(
ArchiveTraceWorker
).
not_to
receive
(
:bulk_perform_async
)
subject
end
end
context
'when a job was succeeded 2 hours ago'
do
let!
(
:build
)
{
create
(
:ci_build
,
:success
,
:trace_live
)
}
before
do
build
.
update
(
finished_at:
2
.
hours
.
ago
)
end
it_behaves_like
'schedules to archive traces'
end
context
'when a job was failed 2 hours ago'
do
let!
(
:build
)
{
create
(
:ci_build
,
:failed
,
:trace_live
)
}
before
do
build
.
update
(
finished_at:
2
.
hours
.
ago
)
end
it_behaves_like
'schedules to archive traces'
end
context
'when a job was cancelled 2 hours ago'
do
let!
(
:build
)
{
create
(
:ci_build
,
:canceled
,
:trace_live
)
}
before
do
build
.
update
(
finished_at:
2
.
hours
.
ago
)
end
it_behaves_like
'schedules to archive traces'
end
context
'when a job has been finished 10 minutes ago'
do
let!
(
:build
)
{
create
(
:ci_build
,
:success
,
:trace_live
)
}
before
do
build
.
update
(
finished_at:
10
.
minutes
.
ago
)
end
it_behaves_like
'does not schedule to archive traces'
end
context
'when a job is running'
do
let!
(
:build
)
{
create
(
:ci_build
,
:running
,
:trace_live
)
}
it_behaves_like
'does not schedule to archive traces'
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