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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
1c60ff0b
Commit
1c60ff0b
authored
Jun 10, 2016
by
Kamil Trzcinski
Committed by
Phil Hughes
Jun 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test ExpireBuildArtifactsWorker
parent
6013768f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
1 deletion
+56
-1
app/workers/expire_build_artifacts_worker.rb
app/workers/expire_build_artifacts_worker.rb
+1
-1
spec/workers/expire_build_artifacts_worker_spec.rb
spec/workers/expire_build_artifacts_worker_spec.rb
+55
-0
No files found.
app/workers/expire_build_artifacts_worker.rb
View file @
1c60ff0b
class
ExpireBuildArtifacts
class
ExpireBuildArtifacts
Worker
include
Sidekiq
::
Worker
include
Sidekiq
::
Worker
def
perform
def
perform
...
...
spec/workers/expire_build_artifacts_worker_spec.rb
0 → 100644
View file @
1c60ff0b
require
'spec_helper'
describe
ExpireBuildArtifactsWorker
do
include
RepoHelpers
let
(
:worker
)
{
ExpireBuildArtifactsWorker
.
new
}
describe
'#perform'
do
context
'with expired artifacts'
do
let!
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
artifacts_expire_at:
Time
.
now
-
7
.
days
)
}
it
do
expect_any_instance_of
(
Ci
::
Build
).
to
receive
(
:erase_artifacts!
)
worker
.
perform
build
.
reload
expect
(
build
.
artifacts_expired?
).
to
be_truthy
end
end
context
'with not yet expired artifacts'
do
let!
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
artifacts_expire_at:
Time
.
now
+
7
.
days
)
}
it
do
expect_any_instance_of
(
Ci
::
Build
).
not_to
receive
(
:erase_artifacts!
)
worker
.
perform
build
.
reload
expect
(
build
.
artifacts_expired?
).
to
be_falsey
end
end
context
'without expire date'
do
let!
(
:build
)
{
create
(
:ci_build
,
:artifacts
)
}
it
do
expect_any_instance_of
(
Ci
::
Build
).
not_to
receive
(
:erase_artifacts!
)
worker
.
perform
end
end
context
'for expired artifacts'
do
let!
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
artifacts_expire_at:
Time
.
now
-
7
.
days
)
}
before
do
build
.
erase_artifacts!
end
it
do
expect_any_instance_of
(
Ci
::
Build
).
not_to
receive
(
:erase_artifacts!
)
worker
.
perform
build
.
reload
expect
(
build
.
artifacts_expired?
).
to
be_truthy
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