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
088ca5c3
Commit
088ca5c3
authored
Jan 19, 2022
by
charlie ablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove project.owner from container expiry worker
parent
68755b38
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
4 deletions
+3
-4
app/workers/container_expiration_policy_worker.rb
app/workers/container_expiration_policy_worker.rb
+1
-1
spec/workers/container_expiration_policy_worker_spec.rb
spec/workers/container_expiration_policy_worker_spec.rb
+2
-3
No files found.
app/workers/container_expiration_policy_worker.rb
View file @
088ca5c3
...
@@ -57,7 +57,7 @@ class ContainerExpirationPolicyWorker # rubocop:disable Scalability/IdempotentWo
...
@@ -57,7 +57,7 @@ class ContainerExpirationPolicyWorker # rubocop:disable Scalability/IdempotentWo
def
perform_unthrottled
def
perform_unthrottled
with_runnable_policy
(
preloaded:
true
)
do
|
policy
|
with_runnable_policy
(
preloaded:
true
)
do
|
policy
|
with_context
(
project:
policy
.
project
,
with_context
(
project:
policy
.
project
,
user:
policy
.
project
.
owner
)
do
|
project
:,
user
:|
user:
nil
)
do
|
project
:,
user
:|
ContainerExpirationPolicyService
.
new
(
project
,
user
)
ContainerExpirationPolicyService
.
new
(
project
,
user
)
.
execute
(
policy
)
.
execute
(
policy
)
end
end
...
...
spec/workers/container_expiration_policy_worker_spec.rb
View file @
088ca5c3
...
@@ -60,12 +60,11 @@ RSpec.describe ContainerExpirationPolicyWorker do
...
@@ -60,12 +60,11 @@ RSpec.describe ContainerExpirationPolicyWorker do
context
'with container expiration policies'
do
context
'with container expiration policies'
do
let_it_be
(
:container_expiration_policy
,
reload:
true
)
{
create
(
:container_expiration_policy
,
:runnable
)
}
let_it_be
(
:container_expiration_policy
,
reload:
true
)
{
create
(
:container_expiration_policy
,
:runnable
)
}
let_it_be
(
:container_repository
)
{
create
(
:container_repository
,
project:
container_expiration_policy
.
project
)
}
let_it_be
(
:container_repository
)
{
create
(
:container_repository
,
project:
container_expiration_policy
.
project
)
}
let_it_be
(
:user
)
{
container_expiration_policy
.
project
.
owner
}
context
'a valid policy'
do
context
'a valid policy'
do
it
'runs the policy'
do
it
'runs the policy'
do
expect
(
ContainerExpirationPolicyService
)
expect
(
ContainerExpirationPolicyService
)
.
to
receive
(
:new
).
with
(
container_expiration_policy
.
project
,
user
).
and_call_original
.
to
receive
(
:new
).
with
(
container_expiration_policy
.
project
,
nil
).
and_call_original
expect
(
CleanupContainerRepositoryWorker
).
to
receive
(
:perform_async
).
once
.
and_call_original
expect
(
CleanupContainerRepositoryWorker
).
to
receive
(
:perform_async
).
once
.
and_call_original
expect
{
subject
}.
not_to
raise_error
expect
{
subject
}.
not_to
raise_error
...
@@ -102,7 +101,7 @@ RSpec.describe ContainerExpirationPolicyWorker do
...
@@ -102,7 +101,7 @@ RSpec.describe ContainerExpirationPolicyWorker do
end
end
it
'disables the policy and tracks an error'
do
it
'disables the policy and tracks an error'
do
expect
(
ContainerExpirationPolicyService
).
not_to
receive
(
:new
).
with
(
container_expiration_policy
,
user
)
expect
(
ContainerExpirationPolicyService
).
not_to
receive
(
:new
).
with
(
container_expiration_policy
,
nil
)
expect
(
Gitlab
::
ErrorTracking
).
to
receive
(
:log_exception
).
with
(
instance_of
(
described_class
::
InvalidPolicyError
),
container_expiration_policy_id:
container_expiration_policy
.
id
)
expect
(
Gitlab
::
ErrorTracking
).
to
receive
(
:log_exception
).
with
(
instance_of
(
described_class
::
InvalidPolicyError
),
container_expiration_policy_id:
container_expiration_policy
.
id
)
expect
{
subject
}.
to
change
{
container_expiration_policy
.
reload
.
enabled
}.
from
(
true
).
to
(
false
)
expect
{
subject
}.
to
change
{
container_expiration_policy
.
reload
.
enabled
}.
from
(
true
).
to
(
false
)
...
...
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