summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
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):