mirror of https://github.com/docker/compose.git
Prevent unnecessary inspection of containers when created from an inspect.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
86530287d6
commit
b33d7b3dd8
|
@ -30,4 +30,3 @@ The current state of integration is documented in [SWARM.md](SWARM.md).
|
||||||
Compose works well for applications that are in a single repository and depend on services that are hosted on Docker Hub. If your application depends on another application within your organisation, Compose doesn't work as well.
|
Compose works well for applications that are in a single repository and depend on services that are hosted on Docker Hub. If your application depends on another application within your organisation, Compose doesn't work as well.
|
||||||
|
|
||||||
There are several ideas about how this could work, such as [including external files](https://github.com/docker/fig/issues/318).
|
There are several ideas about how this could work, such as [including external files](https://github.com/docker/fig/issues/318).
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Container(object):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_id(cls, client, id):
|
def from_id(cls, client, id):
|
||||||
return cls(client, client.inspect_container(id))
|
return cls(client, client.inspect_container(id), has_been_inspected=True)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, client, **options):
|
def create(cls, client, **options):
|
||||||
|
|
|
@ -769,17 +769,17 @@ class ServiceTest(DockerClientTestCase):
|
||||||
container = service.create_container(number=next_number, quiet=True)
|
container = service.create_container(number=next_number, quiet=True)
|
||||||
container.start()
|
container.start()
|
||||||
|
|
||||||
self.assertTrue(container.is_running)
|
container.inspect()
|
||||||
self.assertEqual(len(service.containers()), 1)
|
assert container.is_running
|
||||||
|
assert len(service.containers()) == 1
|
||||||
|
|
||||||
service.scale(1)
|
service.scale(1)
|
||||||
|
assert len(service.containers()) == 1
|
||||||
self.assertEqual(len(service.containers()), 1)
|
|
||||||
container.inspect()
|
container.inspect()
|
||||||
self.assertTrue(container.is_running)
|
assert container.is_running
|
||||||
|
|
||||||
captured_output = mock_log.info.call_args[0]
|
captured_output = mock_log.info.call_args[0]
|
||||||
self.assertIn('Desired container number already achieved', captured_output)
|
assert 'Desired container number already achieved' in captured_output
|
||||||
|
|
||||||
@mock.patch('compose.service.log')
|
@mock.patch('compose.service.log')
|
||||||
def test_scale_with_custom_container_name_outputs_warning(self, mock_log):
|
def test_scale_with_custom_container_name_outputs_warning(self, mock_log):
|
||||||
|
|
|
@ -270,12 +270,21 @@ class ProjectTest(unittest.TestCase):
|
||||||
'time': 1420092061,
|
'time': 1420092061,
|
||||||
'timeNano': 14200920610000004000,
|
'timeNano': 14200920610000004000,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'status': 'destroy',
|
||||||
|
'from': 'example/db',
|
||||||
|
'id': 'eeeee',
|
||||||
|
'time': 1420092061,
|
||||||
|
'timeNano': 14200920610000004000,
|
||||||
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
def dt_with_microseconds(dt, us):
|
def dt_with_microseconds(dt, us):
|
||||||
return datetime.datetime.fromtimestamp(dt).replace(microsecond=us)
|
return datetime.datetime.fromtimestamp(dt).replace(microsecond=us)
|
||||||
|
|
||||||
def get_container(cid):
|
def get_container(cid):
|
||||||
|
if cid == 'eeeee':
|
||||||
|
raise NotFound(None, None, "oops")
|
||||||
if cid == 'abcde':
|
if cid == 'abcde':
|
||||||
name = 'web'
|
name = 'web'
|
||||||
labels = {LABEL_SERVICE: name}
|
labels = {LABEL_SERVICE: name}
|
||||||
|
|
Loading…
Reference in New Issue