summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoffrey F <f.joffrey@gmail.com>2015-08-10 10:53:57 -0700
committerJoffrey F <f.joffrey@gmail.com>2015-08-10 10:53:57 -0700
commit139850f3f3b17357bab5ba3edfb745fb14043764 (patch)
treedcd55f54800b49edf7b57a46274b897ac4f08467 /tests
parent4b33a43a2f5024db9c9357d5eeb0b985f0f89154 (diff)
parent1eaf221391fbaf33d855f7821f55dcf5ec8027bc (diff)
downloaddocker-py-139850f3f3b17357bab5ba3edfb745fb14043764.tar.gz
Merge pull request #698 from docker/jhowardmsft-14530-netmode
`network_mode` now necessary in `host_config`
Diffstat (limited to 'tests')
-rw-r--r--tests/integration_test.py34
-rw-r--r--tests/utils_test.py2
2 files changed, 25 insertions, 11 deletions
diff --git a/tests/integration_test.py b/tests/integration_test.py
index 226ea34..59919da 100644
--- a/tests/integration_test.py
+++ b/tests/integration_test.py
@@ -181,7 +181,9 @@ class TestCreateContainerWithBinds(BaseTestCase):
container = self.client.create_container(
'busybox',
['ls', mount_dest], volumes={mount_dest: {}},
- host_config=create_host_config(binds=binds)
+ host_config=create_host_config(
+ binds=binds, network_mode='none'
+ )
)
container_id = container['Id']
self.client.start(container_id)
@@ -221,7 +223,9 @@ class TestCreateContainerWithRoBinds(BaseTestCase):
container = self.client.create_container(
'busybox',
['ls', mount_dest], volumes={mount_dest: {}},
- host_config=create_host_config(binds=binds)
+ host_config=create_host_config(
+ binds=binds, network_mode='none'
+ )
)
container_id = container['Id']
self.client.start(container_id)
@@ -273,7 +277,9 @@ class TestCreateContainerReadOnlyFs(BaseTestCase):
def runTest(self):
ctnr = self.client.create_container(
'busybox', ['mkdir', '/shrine'],
- host_config=create_host_config(read_only=True)
+ host_config=create_host_config(
+ read_only=True, network_mode='none'
+ )
)
self.assertIn('Id', ctnr)
self.tmp_containers.append(ctnr['Id'])
@@ -347,7 +353,9 @@ class TestStartContainerWithDictInsteadOfId(BaseTestCase):
class TestCreateContainerPrivileged(BaseTestCase):
def runTest(self):
res = self.client.create_container(
- 'busybox', 'true', host_config=create_host_config(privileged=True)
+ 'busybox', 'true', host_config=create_host_config(
+ privileged=True, network_mode='none'
+ )
)
self.assertIn('Id', res)
self.tmp_containers.append(res['Id'])
@@ -591,7 +599,9 @@ class TestPort(BaseTestCase):
container = self.client.create_container(
'busybox', ['sleep', '60'], ports=list(port_bindings.keys()),
- host_config=create_host_config(port_bindings=port_bindings)
+ host_config=create_host_config(
+ port_bindings=port_bindings, network_mode='bridge'
+ )
)
id = container['Id']
@@ -717,7 +727,9 @@ class TestCreateContainerWithVolumesFrom(BaseTestCase):
)
res2 = self.client.create_container(
'busybox', 'cat', detach=True, stdin_open=True,
- host_config=create_host_config(volumes_from=vol_names)
+ host_config=create_host_config(
+ volumes_from=vol_names, network_mode='none'
+ )
)
container3_id = res2['Id']
self.tmp_containers.append(container3_id)
@@ -760,7 +772,8 @@ class TestCreateContainerWithLinks(BaseTestCase):
res2 = self.client.create_container(
'busybox', 'env', host_config=create_host_config(
- links={link_path1: link_alias1, link_path2: link_alias2}
+ links={link_path1: link_alias1, link_path2: link_alias2},
+ network_mode='none'
)
)
container3_id = res2['Id']
@@ -781,7 +794,8 @@ class TestRestartingContainer(BaseTestCase):
def runTest(self):
container = self.client.create_container(
'busybox', ['sleep', '2'], host_config=create_host_config(
- restart_policy={"Name": "always", "MaximumRetryCount": 0}
+ restart_policy={"Name": "always", "MaximumRetryCount": 0},
+ network_mode='none'
)
)
id = container['Id']
@@ -910,7 +924,7 @@ class TestCreateContainerWithHostPidMode(BaseTestCase):
def runTest(self):
ctnr = self.client.create_container(
'busybox', 'true', host_config=create_host_config(
- pid_mode='host'
+ pid_mode='host', network_mode='none'
)
)
self.assertIn('Id', ctnr)
@@ -945,7 +959,7 @@ class TestRemoveLink(BaseTestCase):
container2 = self.client.create_container(
'busybox', 'cat', host_config=create_host_config(
- links={link_path: link_alias}
+ links={link_path: link_alias}, network_mode='none'
)
)
container2_id = container2['Id']
diff --git a/tests/utils_test.py b/tests/utils_test.py
index a73d949..8acd47d 100644
--- a/tests/utils_test.py
+++ b/tests/utils_test.py
@@ -141,7 +141,7 @@ class UtilsTest(base.BaseTestCase):
self.assertEqual(convert_filters(filters), expected)
def test_create_empty_host_config(self):
- empty_config = create_host_config()
+ empty_config = create_host_config(network_mode='')
self.assertEqual(empty_config, {})
def test_create_host_config_dict_ulimit(self):