Skip to content

Remove the comparison container's anonymous volumes in docker_container.running - #27

Open
rstarkey-block wants to merge 1 commit into
salt-extensions:mainfrom
rstarkey-block:temp-container-volumes
Open

rstarkey-block wants to merge 1 commit into
salt-extensions:mainfrom
rstarkey-block:temp-container-volumes

Conversation

@rstarkey-block

Copy link
Copy Markdown

On every run where a container already exists with an unchanged image, docker_container.running creates a temporary container to compare against and then removes it without its volumes, so an image that declares a VOLUME leaks one anonymous volume per run. This removes the temporary container's volumes along with it.

  • _delete_temp_container calls docker.rm(temp_container_name, volumes=True). Volumes of replaced or removed containers are left alone, since they may hold data.
  • Adds a functional test (an image with a VOLUME, two unchanged runs, no new dangling volume) and a changelog fragment.

  • The related _replace fix is tracked in #25.

@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.90%. Comparing base (792add6) to head (81de625).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
tests/functional/states/test_docker_container.py 86.20% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #27      +/-   ##
==========================================
+ Coverage   42.66%   42.90%   +0.23%     
==========================================
  Files          25       25              
  Lines        6495     6524      +29     
  Branches     1120     1122       +2     
==========================================
+ Hits         2771     2799      +28     
  Misses       3469     3469              
- Partials      255      256       +1     
Flag Coverage Δ
Linux 42.88% <86.66%> (+0.23%) ⬆️
project 38.53% <100.00%> (+0.06%) ⬆️
py310 42.84% <86.66%> (+0.23%) ⬆️
py311 42.84% <86.66%> (+0.23%) ⬆️
py314 42.84% <86.66%> (+0.23%) ⬆️
salt_3006_27 42.84% <86.66%> (+0.23%) ⬆️
salt_3008_2 42.84% <86.66%> (+0.23%) ⬆️
tests 51.32% <86.20%> (+0.46%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant