Disable the use of 'net' in v2

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2016-01-13 14:05:30 +00:00
parent 69ed5f9c48
commit 35e347cf92
4 changed files with 41 additions and 1 deletions

View File

@ -89,7 +89,6 @@
"mac_address": {"type": "string"}, "mac_address": {"type": "string"},
"mem_limit": {"type": ["number", "string"]}, "mem_limit": {"type": ["number", "string"]},
"memswap_limit": {"type": ["number", "string"]}, "memswap_limit": {"type": ["number", "string"]},
"net": {"type": "string"},
"pid": {"type": ["string", "null"]}, "pid": {"type": ["string", "null"]},
"ports": { "ports": {

View File

@ -422,6 +422,30 @@ class CLITestCase(DockerClientTestCase):
self.assertEqual(len(db.containers()), 1) self.assertEqual(len(db.containers()), 1)
self.assertEqual(len(console.containers()), 0) self.assertEqual(len(console.containers()), 0)
def test_up_with_net_is_invalid(self):
self.base_dir = 'tests/fixtures/net-container'
result = self.dispatch(
['-f', 'v2-invalid.yml', 'up', '-d'],
returncode=1)
# TODO: fix validation error messages for v2 files
# assert "Unsupported config option for service 'web': 'net'" in exc.exconly()
assert "Unsupported config option" in result.stderr
def test_up_with_net_v1(self):
self.base_dir = 'tests/fixtures/net-container'
self.dispatch(['up', '-d'], None)
bar = self.project.get_service('bar')
bar_container = bar.containers()[0]
foo = self.project.get_service('foo')
foo_container = foo.containers()[0]
assert foo_container.get('HostConfig.NetworkMode') == \
'container:{}'.format(bar_container.id)
def test_up_with_no_deps(self): def test_up_with_no_deps(self):
self.base_dir = 'tests/fixtures/links-composefile' self.base_dir = 'tests/fixtures/links-composefile'
self.dispatch(['up', '-d', '--no-deps', 'web'], None) self.dispatch(['up', '-d', '--no-deps', 'web'], None)

View File

@ -0,0 +1,7 @@
foo:
image: busybox
command: top
net: "container:bar"
bar:
image: busybox
command: top

View File

@ -0,0 +1,10 @@
version: 2
services:
foo:
image: busybox
command: top
bar:
image: busybox
command: top
net: "container:foo"