summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Nephin <dnephin@gmail.com>2015-11-16 11:37:15 -0500
committerDaniel Nephin <dnephin@gmail.com>2015-11-16 11:37:15 -0500
commit4e441b2a6bbac7b9b43adca05800c8f46e18ec16 (patch)
tree7d7a82677f2483d64b6eda53a64586c2eaf38de7 /tests
parentac148393b13ae09dde0d4cfcf0208e7c97649926 (diff)
parent64fc383f2c573daab75c85459e87052ef0a31cdd (diff)
downloaddocker-py-4e441b2a6bbac7b9b43adca05800c8f46e18ec16.tar.gz
Merge pull request #834 from lots0logs/814-host-config-mem-swap
Add support for MemorySwappiness to client.create_host_config()
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/container_test.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/integration/container_test.py b/tests/integration/container_test.py
index 7db7240..9bff6fc 100644
--- a/tests/integration/container_test.py
+++ b/tests/integration/container_test.py
@@ -335,6 +335,38 @@ class CreateContainerTest(api_test.BaseTestCase):
self.assertEqual(container_log_config['Type'], "json-file")
self.assertEqual(container_log_config['Config'], {})
+ def test_create_with_memory_constraints_with_str(self):
+ ctnr = self.client.create_container(
+ BUSYBOX, 'true',
+ host_config=self.client.create_host_config(
+ memswap_limit='1G',
+ mem_limit='700M'
+ )
+ )
+ self.assertIn('Id', ctnr)
+ self.tmp_containers.append(ctnr['Id'])
+ self.client.start(ctnr)
+ inspect = self.client.inspect_container(ctnr)
+
+ self.assertIn('HostConfig', inspect)
+ host_config = inspect['HostConfig']
+ for limit in ['Memory', 'MemorySwap']:
+ self.assertIn(limit, host_config)
+
+ def test_create_with_memory_constraints_with_int(self):
+ ctnr = self.client.create_container(
+ BUSYBOX, 'true',
+ host_config=self.client.create_host_config(mem_swappiness=40)
+ )
+ self.assertIn('Id', ctnr)
+ self.tmp_containers.append(ctnr['Id'])
+ self.client.start(ctnr)
+ inspect = self.client.inspect_container(ctnr)
+
+ self.assertIn('HostConfig', inspect)
+ host_config = inspect['HostConfig']
+ self.assertIn('MemorySwappiness', host_config)
+
class VolumeBindTest(api_test.BaseTestCase):
def setUp(self):