Merge pull request #2609 from dnephin/dont_warn_on_container_volume

Don't warn when the container volume is a compose option
This commit is contained in:
Daniel Nephin 2016-01-08 17:18:02 -05:00
commit fc57fc1dc1
2 changed files with 13 additions and 0 deletions

View File

@ -887,6 +887,7 @@ def warn_on_masked_volume(volumes_option, container_volumes, service):
for volume in volumes_option:
if (
volume.external and
volume.internal in container_volumes and
container_volumes.get(volume.internal) != volume.external
):

View File

@ -781,6 +781,18 @@ class ServiceVolumesTest(unittest.TestCase):
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):
self.mock_client.inspect_image.return_value = {'Id': 'imageid'}