Add --tail flag as option on logs.

Closes #265
Signed-off-by: Stéphane Seguin <stephseguin93@gmail.com>
This commit is contained in:
Stéphane Seguin 2016-02-28 22:00:53 +01:00
commit 9b36dc5c54
6 changed files with 33 additions and 9 deletions

View file

@ -1171,6 +1171,14 @@ class CLITestCase(DockerClientTestCase):
self.assertRegexpMatches(result.stdout, '(\d{4})-(\d{2})-(\d{2})T(\d{2})\:(\d{2})\:(\d{2})')
def test_logs_tail(self):
self.base_dir = 'tests/fixtures/logs-tail-composefile'
self.dispatch(['up'], None)
result = self.dispatch(['logs', '--tail', '2'], None)
assert result.stdout.count('\n') == 3
def test_kill(self):
self.dispatch(['up', '-d'], None)
service = self.project.get_service('simple')

View file

@ -0,0 +1,3 @@
simple:
image: busybox:latest
command: sh -c "echo a && echo b && echo c && echo d"

View file

@ -47,7 +47,7 @@ class TestLogPrinter(object):
# Call count is 2 lines + "container exited line"
assert output_stream.flush.call_count == 3
def test_single_container_without_follow(self, output_stream, mock_container):
def test_single_container_without_stream(self, output_stream, mock_container):
LogPrinter([mock_container], output=output_stream, follow=False).run()
output = output_stream.getvalue()