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
e53c6cfb
Commit
e53c6cfb
authored
Jan 21, 2021
by
David Fernandez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log the project id
parent
fe289694
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
app/workers/container_expiration_policies/cleanup_container_repository_worker.rb
...xpiration_policies/cleanup_container_repository_worker.rb
+2
-1
spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb
...tion_policies/cleanup_container_repository_worker_spec.rb
+4
-1
No files found.
app/workers/container_expiration_policies/cleanup_container_repository_worker.rb
View file @
e53c6cfb
...
...
@@ -25,6 +25,7 @@ module ContainerExpirationPolicies
return
unless
container_repository
log_extra_metadata_on_done
(
:container_repository_id
,
container_repository
.
id
)
log_extra_metadata_on_done
(
:project_id
,
project
.
id
)
unless
allowed_to_run?
(
container_repository
)
container_repository
.
cleanup_unscheduled!
...
...
@@ -78,7 +79,7 @@ module ContainerExpirationPolicies
end
def
project
container_repository
&
.
project
container_repository
.
project
end
def
container_repository
...
...
spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb
View file @
e53c6cfb
...
...
@@ -82,6 +82,7 @@ RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do
it
'skips the repository'
do
expect
(
ContainerExpirationPolicies
::
CleanupService
).
not_to
receive
(
:new
)
expect
(
worker
).
to
receive
(
:log_extra_metadata_on_done
).
with
(
:container_repository_id
,
repository
.
id
)
expect
(
worker
).
to
receive
(
:log_extra_metadata_on_done
).
with
(
:project_id
,
repository
.
project
.
id
)
expect
(
worker
).
to
receive
(
:log_extra_metadata_on_done
).
with
(
:cleanup_status
,
:skipped
)
expect
{
subject
}.
to
change
{
ContainerRepository
.
waiting_for_cleanup
.
count
}.
from
(
1
).
to
(
0
)
...
...
@@ -213,8 +214,10 @@ RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do
end
def
expect_log_extra_metadata
(
service_response
:,
cleanup_status: :finished
,
truncated:
false
)
expect
(
worker
).
to
receive
(
:log_extra_metadata_on_done
).
with
(
:cleanup_status
,
cleanup_status
)
expect
(
worker
).
to
receive
(
:log_extra_metadata_on_done
).
with
(
:container_repository_id
,
repository
.
id
)
expect
(
worker
).
to
receive
(
:log_extra_metadata_on_done
).
with
(
:project_id
,
repository
.
project
.
id
)
expect
(
worker
).
to
receive
(
:log_extra_metadata_on_done
).
with
(
:cleanup_status
,
cleanup_status
)
%i[cleanup_tags_service_original_size cleanup_tags_service_before_truncate_size cleanup_tags_service_after_truncate_size cleanup_tags_service_before_delete_size]
.
each
do
|
field
|
value
=
service_response
.
payload
[
field
]
expect
(
worker
).
to
receive
(
:log_extra_metadata_on_done
).
with
(
field
,
value
)
unless
value
.
nil?
...
...
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