Merge "Use docker.logs instead of get_container_logs"

This commit is contained in:
Jenkins 2017-05-08 02:31:36 +00:00 committed by Gerrit Code Review
commit bd887c42e1
3 changed files with 6 additions and 14 deletions

View File

@ -342,9 +342,8 @@ class DockerDriver(driver.ContainerDriver):
tail = 'all'
if since is None or since == 'None':
return docker.get_container_logs(container.container_id,
stdout, stderr, False,
timestamps, tail, None)
return docker.logs(container.container_id, stdout, stderr,
False, timestamps, tail, None)
else:
try:
since = int(since)
@ -355,9 +354,8 @@ class DockerDriver(driver.ContainerDriver):
'%Y-%m-%d %H:%M:%S,%f')
except Exception:
raise
return docker.get_container_logs(container.container_id,
stdout, stderr, False,
timestamps, tail, since)
return docker.logs(container.container_id, stdout, stderr,
False, timestamps, tail, since)
@check_container_id
def execute_create(self, container, command, interactive=False):

View File

@ -80,9 +80,3 @@ class DockerHTTPClient(client.Client):
def list_containers(self):
return self.containers(all=True, filters={'name': 'zun-'})
def get_container_logs(self, docker_id, stdout, stderr, stream,
timestamps, tail, since):
"""Fetch the logs of a container."""
return self.logs(docker_id, stdout, stderr, False,
timestamps, tail, since)

View File

@ -250,10 +250,10 @@ class TestDockerDriver(base.DriverTestCase):
consts.RUNNING)
def test_show_logs(self):
self.mock_docker.get_container_logs = mock.Mock()
self.mock_docker.logs = mock.Mock()
mock_container = mock.MagicMock()
self.driver.show_logs(mock_container)
self.mock_docker.get_container_logs.assert_called_once_with(
self.mock_docker.logs.assert_called_once_with(
mock_container.container_id, True, True, False, False,
'all', None)