-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Added retries to the container state check in TestDocker #12640
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
Conversation
LocalStack Community integration with Pro2 files ± 0 2 suites ±0 32s ⏱️ - 1h 44m 42s Results for commit d5415dc. ± Comparison against base commit fa0bbcd. This pull request removes 4450 tests.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -1273,22 +1277,39 @@ def test_run_container_non_existent_image(self, docker_client: ContainerClient): | |||
def test_running_container_names(self, docker_client: ContainerClient, dummy_container): | |||
docker_client.start_container(dummy_container.container_id) | |||
name = dummy_container.container_name | |||
assert name in docker_client.get_running_container_names() | |||
retry( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment: This works because the retry catches the AssertionError, which doesn't happen in, e.g., poll_condition
. Was a bit confused at first :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Motivation
I missed fixing one of the flaky tests in the
TestDockerClient
class in the PR #12625 that was merged today. Liketest_is_container_running
, testtest_running_container_names
fails due to a race condition:We need to wait until the container is fully stopped. I also added a retry to the container start step, just to be safe.
Changes
_assert_container_state
which is used intest_running_container_names
andtest_is_container_running
test_running_container_names
Testing
Tested here (transcribe tests are failing but it is not connected to changes in this PR, tests changed in this PR are passing): https://github.com/localstack/localstack/actions/runs/15117166475