mirror of https://github.com/docker/docs.git
Fix a test case that assumes busybox image id.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
1e25d40c53
commit
c37a0c38a2
|
@ -12,6 +12,7 @@ from six import text_type
|
||||||
|
|
||||||
from .. import mock
|
from .. import mock
|
||||||
from .testcases import DockerClientTestCase
|
from .testcases import DockerClientTestCase
|
||||||
|
from .testcases import pull_busybox
|
||||||
from compose import __version__
|
from compose import __version__
|
||||||
from compose.const import LABEL_CONTAINER_NUMBER
|
from compose.const import LABEL_CONTAINER_NUMBER
|
||||||
from compose.const import LABEL_ONE_OFF
|
from compose.const import LABEL_ONE_OFF
|
||||||
|
@ -549,8 +550,10 @@ class ServiceTest(DockerClientTestCase):
|
||||||
})
|
})
|
||||||
|
|
||||||
def test_create_with_image_id(self):
|
def test_create_with_image_id(self):
|
||||||
# Image id for the current busybox:latest
|
# Get image id for the current busybox:latest
|
||||||
service = self.create_service('foo', image='8c2e06607696')
|
pull_busybox(self.client)
|
||||||
|
image_id = self.client.inspect_image('busybox:latest')['Id'][:12]
|
||||||
|
service = self.create_service('foo', image=image_id)
|
||||||
service.create_container()
|
service.create_container()
|
||||||
|
|
||||||
def test_scale(self):
|
def test_scale(self):
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from docker import errors
|
||||||
|
|
||||||
from .. import unittest
|
from .. import unittest
|
||||||
from compose.cli.docker_client import docker_client
|
from compose.cli.docker_client import docker_client
|
||||||
from compose.config.config import ServiceLoader
|
from compose.config.config import ServiceLoader
|
||||||
|
@ -9,6 +11,13 @@ from compose.progress_stream import stream_output
|
||||||
from compose.service import Service
|
from compose.service import Service
|
||||||
|
|
||||||
|
|
||||||
|
def pull_busybox(client):
|
||||||
|
try:
|
||||||
|
client.inspect_image('busybox:latest')
|
||||||
|
except errors.APIError:
|
||||||
|
client.pull('busybox:latest', stream=False)
|
||||||
|
|
||||||
|
|
||||||
class DockerClientTestCase(unittest.TestCase):
|
class DockerClientTestCase(unittest.TestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
|
Loading…
Reference in New Issue