mirror of https://github.com/docker/docs.git
Don't warn when the container volume is specified as a compose option.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
4017ea99fe
commit
ad9011ed96
|
@ -880,6 +880,7 @@ def warn_on_masked_volume(volumes_option, container_volumes, service):
|
||||||
|
|
||||||
for volume in volumes_option:
|
for volume in volumes_option:
|
||||||
if (
|
if (
|
||||||
|
volume.external and
|
||||||
volume.internal in container_volumes and
|
volume.internal in container_volumes and
|
||||||
container_volumes.get(volume.internal) != volume.external
|
container_volumes.get(volume.internal) != volume.external
|
||||||
):
|
):
|
||||||
|
|
|
@ -742,6 +742,18 @@ class ServiceVolumesTest(unittest.TestCase):
|
||||||
|
|
||||||
assert not mock_log.warn.called
|
assert not mock_log.warn.called
|
||||||
|
|
||||||
|
def test_warn_on_masked_no_warning_with_container_only_option(self):
|
||||||
|
volumes_option = [VolumeSpec(None, '/path', 'rw')]
|
||||||
|
container_volumes = [
|
||||||
|
VolumeSpec('/var/lib/docker/volume/path', '/path', 'rw')
|
||||||
|
]
|
||||||
|
service = 'service_name'
|
||||||
|
|
||||||
|
with mock.patch('compose.service.log', autospec=True) as mock_log:
|
||||||
|
warn_on_masked_volume(volumes_option, container_volumes, service)
|
||||||
|
|
||||||
|
assert not mock_log.warn.called
|
||||||
|
|
||||||
def test_create_with_special_volume_mode(self):
|
def test_create_with_special_volume_mode(self):
|
||||||
self.mock_client.inspect_image.return_value = {'Id': 'imageid'}
|
self.mock_client.inspect_image.return_value = {'Id': 'imageid'}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue