Merge "Populate container fields for new container"

This commit is contained in:
Zuul 2017-11-30 03:04:09 +00:00 committed by Gerrit Code Review
commit ded601dd03
2 changed files with 6 additions and 2 deletions

View File

@ -195,8 +195,8 @@ class DockerDriver(driver.ContainerDriver):
context, container, requested_networks, network_api)
container.addresses = addresses
container.status = consts.CREATED
container.status_reason = None
response = docker.inspect_container(container.container_id)
self._populate_container(container, response)
container.save(context)
return container

View File

@ -100,8 +100,12 @@ class TestDockerDriver(base.DriverTestCase):
return_value={'Id': 'val1', 'key1': 'val2'})
self.mock_docker.create_networking_config = mock.Mock(
return_value={'Id': 'val1', 'key1': 'val2'})
self.mock_docker.inspect_container = mock.Mock(
return_value={'State': 'created',
'Config': {'Cmd': ['fake_command']}})
image = {'path': '', 'image': '', 'repo': '', 'tag': ''}
mock_container = self.mock_default_container
mock_container.status = 'Creating'
networks = [{'network': 'fake-network'}]
volumes = []
fake_port = {'mac_address': 'fake_mac'}