Revert "Merge pull request #711 from dnephin/fix_volumes_on_recreate"
This reverts commit55095ef488, reversing changes made to72095f54b2. Signed-off-by: Daniel Nephin <dnephin@yelp.com>
This commit is contained in:
parent
55095ef488
commit
2dd1cc80ca
4 changed files with 66 additions and 144 deletions
|
|
@ -11,15 +11,13 @@ from requests import Response
|
|||
from fig import Service
|
||||
from fig.container import Container
|
||||
from fig.service import (
|
||||
APIError,
|
||||
ConfigError,
|
||||
build_port_bindings,
|
||||
build_volume_binding,
|
||||
get_container_data_volumes,
|
||||
get_volume_bindings,
|
||||
parse_repository_tag,
|
||||
parse_volume_spec,
|
||||
split_port,
|
||||
build_port_bindings,
|
||||
parse_volume_spec,
|
||||
build_volume_binding,
|
||||
APIError,
|
||||
parse_repository_tag,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -59,6 +57,13 @@ class ServiceTest(unittest.TestCase):
|
|||
|
||||
self.assertEqual(service._get_volumes_from(), [container_id])
|
||||
|
||||
def test_get_volumes_from_intermediate_container(self):
|
||||
container_id = 'aabbccddee'
|
||||
service = Service('test')
|
||||
container = mock.Mock(id=container_id, spec=Container)
|
||||
|
||||
self.assertEqual(service._get_volumes_from(container), [container_id])
|
||||
|
||||
def test_get_volumes_from_service_container_exists(self):
|
||||
container_ids = ['aabbccddee', '12345']
|
||||
from_service = mock.create_autospec(Service)
|
||||
|
|
@ -283,50 +288,6 @@ class ServiceVolumesTest(unittest.TestCase):
|
|||
binding,
|
||||
('/home/user', dict(bind='/home/user', ro=False)))
|
||||
|
||||
def test_get_container_data_volumes(self):
|
||||
options = [
|
||||
'/host/volume:/host/volume:ro',
|
||||
'/new/volume',
|
||||
'/existing/volume',
|
||||
]
|
||||
|
||||
container = Container(None, {
|
||||
'Volumes': {
|
||||
'/host/volume': '/host/volume',
|
||||
'/existing/volume': '/var/lib/docker/aaaaaaaa',
|
||||
'/removed/volume': '/var/lib/docker/bbbbbbbb',
|
||||
},
|
||||
}, has_been_inspected=True)
|
||||
|
||||
expected = {
|
||||
'/var/lib/docker/aaaaaaaa': {'bind': '/existing/volume', 'ro': False},
|
||||
}
|
||||
|
||||
binds = get_container_data_volumes(container, options)
|
||||
self.assertEqual(binds, expected)
|
||||
|
||||
def test_get_volume_bindings(self):
|
||||
options = [
|
||||
'/host/volume:/host/volume:ro',
|
||||
'/host/rw/volume:/host/rw/volume',
|
||||
'/new/volume',
|
||||
'/existing/volume',
|
||||
]
|
||||
|
||||
intermediate_container = Container(None, {
|
||||
'Volumes': {'/existing/volume': '/var/lib/docker/aaaaaaaa'},
|
||||
}, has_been_inspected=True)
|
||||
|
||||
expected = {
|
||||
'/host/volume': {'bind': '/host/volume', 'ro': True},
|
||||
'/host/rw/volume': {'bind': '/host/rw/volume', 'ro': False},
|
||||
'/var/lib/docker/aaaaaaaa': {'bind': '/existing/volume', 'ro': False},
|
||||
}
|
||||
|
||||
binds = get_volume_bindings(options, intermediate_container)
|
||||
self.assertEqual(binds, expected)
|
||||
|
||||
|
||||
class ServiceEnvironmentTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue