Skip to content

Improve remove docker container function to take into account stopped containers #12979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bryansan-local
Copy link
Contributor

@bryansan-local bryansan-local commented Aug 8, 2025

Motivation

Right now, this remove container method doesn't take into account stopped containers when you ask it to check for existence of it

Related PR for more context about why bother with this change -> https://github.com/localstack/localstack-pro/pull/5037

Changes

  • I have introduced a new method to return all containers including stopped ones (get_all_container_names) I didn't touch the old method (get_running_container_names) to keep compatibility and not break any code already using it.
  • I changed the remove container method to use this new method ^ so it takes into account stopped containers when you ask it to check for existence. This is kinda a breaking change BUT in my opinion this is an improvement to the remove operation.

@bryansan-local bryansan-local self-assigned this Aug 8, 2025
Copy link

github-actions bot commented Aug 8, 2025

Test Results - Preflight, Unit

22 063 tests  ±0   20 329 ✅ ±0   6m 23s ⏱️ -4s
     1 suites ±0    1 734 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit 2f1b32b. ± Comparison against base commit 4464cd2.

Copy link

github-actions bot commented Aug 8, 2025

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 8s ⏱️ -9s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 2f1b32b. ± Comparison against base commit 4464cd2.

@bryansan-local bryansan-local marked this pull request as ready for review August 8, 2025 15:56
@bryansan-local bryansan-local added the semver: patch Non-breaking changes which can be included in patch releases label Aug 8, 2025
Copy link

github-actions bot commented Aug 8, 2025

Test Results (amd64) - Integration, Bootstrap

    5 files  ±0      5 suites  ±0   2h 21m 59s ⏱️ + 1m 26s
4 982 tests ±0  4 393 ✅ ±0  589 💤 ±0  0 ❌ ±0 
4 988 runs  ±0  4 393 ✅ ±0  595 💤 ±0  0 ❌ ±0 

Results for commit 2f1b32b. ± Comparison against base commit 4464cd2.

@coveralls
Copy link

Coverage Status

coverage: 83.016% (-3.8%) from 86.841%
when pulling 2f1b32b on feature/improve_remove_container
into 4464cd2 on main.

Copy link

github-actions bot commented Aug 8, 2025

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 44m 9s ⏱️ - 1m 45s
4 623 tests ±0  4 186 ✅ ±0  437 💤 ±0  0 ❌ ±0 
4 625 runs  ±0  4 186 ✅ ±0  439 💤 ±0  0 ❌ ±0 

Results for commit 2f1b32b. ± Comparison against base commit 4464cd2.

Copy link
Member

@alexrashed alexrashed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch and thanks for jumping on this! Once there is a test for this, we should be good to go! 💯

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: This module is incredibly important and well-tested, and we basically try to have tests for every change whenever possible. Could you please add a test for this edge case to the test for this module?
The tests are done in this class here:


When adding a new test, it will automatically be executed for both - the SDK and the CMD client. :)

Copy link
Member

@dfangl dfangl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I agree with Alex on the tests, would be nice to get one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants