Merge pull request #3310 from aanand/fix-logs-test

Attempt to fix flaky logs test
This commit is contained in:
Daniel Nephin 2016-04-12 10:44:04 -04:00
commit f10bc8072e
2 changed files with 8 additions and 7 deletions

View File

@ -1257,13 +1257,14 @@ class CLITestCase(DockerClientTestCase):
'logscomposefile_another_1', 'logscomposefile_another_1',
'exited')) 'exited'))
# sleep for a short period to allow the tailing thread to receive the self.dispatch(['kill', 'simple'])
# event. This is not great, but there isn't an easy way to do this
# without being able to stream stdout from the process. result = wait_on_process(proc)
time.sleep(0.5)
os.kill(proc.pid, signal.SIGINT) assert 'hello' in result.stdout
result = wait_on_process(proc, returncode=1)
assert 'test' in result.stdout assert 'test' in result.stdout
assert 'logscomposefile_another_1 exited with code 0' in result.stdout
assert 'logscomposefile_simple_1 exited with code 137' in result.stdout
def test_logs_default(self): def test_logs_default(self):
self.base_dir = 'tests/fixtures/logs-composefile' self.base_dir = 'tests/fixtures/logs-composefile'

View File

@ -1,6 +1,6 @@
simple: simple:
image: busybox:latest image: busybox:latest
command: sh -c "echo hello && sleep 200" command: sh -c "echo hello && tail -f /dev/null"
another: another:
image: busybox:latest image: busybox:latest
command: sh -c "echo test" command: sh -c "echo test"