Merge "Trim container id to a suitable size"

This commit is contained in:
Jenkins 2016-09-01 10:35:18 +00:00 committed by Gerrit Code Review
commit 1a304dd762
2 changed files with 4 additions and 5 deletions

View File

@ -275,8 +275,8 @@ class DockerProfile(base.Profile):
raise exc.EResourceCreation(type='container',
message=six.text_type(ex))
self.container_id = container.id
return container.id
self.container_id = container['Id'][:36]
return self.container_id
def do_delete(self, obj):
"""Delete a container node.

View File

@ -272,10 +272,9 @@ class TestContainerDockerProfile(base.SenlinTestCase):
def test_do_create(self, mock_docker):
dockerclient = mock.Mock()
mock_docker.return_value = dockerclient
container = mock.Mock()
container = {'Id': 'd' * 64}
dockerclient.container_create.return_value = container
container_id = mock.Mock()
container.id = container_id
container_id = 'd' * 36
profile = docker_profile.DockerProfile('container', self.spec)
obj = mock.Mock()
self.assertEqual(container_id, profile.do_create(obj))