From 74e0c5eb8c38f0a219cc0120bc51de99c1c8159e Mon Sep 17 00:00:00 2001 From: Milas Bowman Date: Tue, 26 Jul 2022 12:55:14 -0400 Subject: [PATCH] test: fix flaky container log test Ensure the container has exited before attempting to grab the logs. Since we are not streaming them, it's possible to attach + grab logs before the output is processed, resulting in a test failure. If the container has exited, it's guaranteed to have logged :) Signed-off-by: Milas Bowman --- tests/integration/api_container_test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/integration/api_container_test.py b/tests/integration/api_container_test.py index 062693ef..0d6d9f96 100644 --- a/tests/integration/api_container_test.py +++ b/tests/integration/api_container_test.py @@ -1217,12 +1217,14 @@ class AttachContainerTest(BaseAPIIntegrationTest): data = read_exactly(pty_stdout, next_size) assert data.decode('utf-8') == line + @pytest.mark.timeout(10) def test_attach_no_stream(self): container = self.client.create_container( TEST_IMG, 'echo hello' ) self.tmp_containers.append(container) self.client.start(container) + self.client.wait(container, condition='not-running') output = self.client.attach(container, stream=False, logs=True) assert output == 'hello\n'.encode(encoding='ascii')