From 537d435a28ab10274b4a8e9ed320e58cad44432e Mon Sep 17 00:00:00 2001 From: Aanand Prasad Date: Fri, 26 Sep 2014 10:58:52 -0700 Subject: [PATCH] Fix race condition in cli_test.py We weren't waiting for the build to finish, causing the rest of the test to occasionally fail when looking for the image. Signed-off-by: Aanand Prasad --- tests/integration/cli_test.py | 2 +- tests/integration/testcases.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/integration/cli_test.py b/tests/integration/cli_test.py index c8bf09816..10afbe7a6 100644 --- a/tests/integration/cli_test.py +++ b/tests/integration/cli_test.py @@ -170,7 +170,7 @@ class CLITestCase(DockerClientTestCase): @patch('dockerpty.start') def test_run_without_command(self, __): self.command.base_dir = 'tests/fixtures/commands-figfile' - self.client.build('tests/fixtures/simple-dockerfile', tag='figtest_test') + self.check_build('tests/fixtures/simple-dockerfile', tag='figtest_test') for c in self.project.containers(stopped=True, one_off=True): c.remove() diff --git a/tests/integration/testcases.py b/tests/integration/testcases.py index c882f20e5..37d74b589 100644 --- a/tests/integration/testcases.py +++ b/tests/integration/testcases.py @@ -3,6 +3,7 @@ from __future__ import absolute_import from docker import Client from fig.service import Service from fig.cli.utils import docker_url +from fig.progress_stream import stream_output from .. import unittest @@ -31,5 +32,6 @@ class DockerClientTestCase(unittest.TestCase): **kwargs ) - - + def check_build(self, *args, **kwargs): + build_output = self.client.build(*args, **kwargs) + stream_output(build_output, open('/dev/null', 'w'))