mirror of https://github.com/docker/docker-py.git
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 <milas.bowman@docker.com>
This commit is contained in:
parent
7168e09b16
commit
74e0c5eb8c
|
@ -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')
|
||||
|
||||
|
|
Loading…
Reference in New Issue