diff options
author | Mazz Mosley <mazz@houseofmnowster.com> | 2015-08-17 15:42:49 +0100 |
---|---|---|
committer | Mazz Mosley <mazz@houseofmnowster.com> | 2015-08-26 16:10:28 +0100 |
commit | 9937a31a88b9a5de248bd631cc9eb1a83c48f56f (patch) | |
tree | 1dc72afacf31bd16e738de78d25cb32257d046d9 | |
parent | 35b30e69df3b772f6e684405a8f10cb31039e661 (diff) | |
download | docker-py-9937a31a88b9a5de248bd631cc9eb1a83c48f56f.tar.gz |
Test valid no args for log config
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
-rw-r--r-- | tests/integration_test.py | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/tests/integration_test.py b/tests/integration_test.py index 1de3ae7..2de4a7f 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -255,7 +255,7 @@ class CreateContainerWithLogConfigTest(BaseTestCase): container = self.client.create_container( 'busybox', ['true'], - host_config=self.client.create_host_config(log_config=config) + host_config=self.client.create_host_config(log_config=log_config) ) self.tmp_containers.append(container['Id']) self.client.start(container) @@ -274,7 +274,7 @@ class CreateContainerWithLogConfigTest(BaseTestCase): container = self.client.create_container( 'busybox', ['true'], - host_config=create_host_config(log_config=log_config) + host_config=self.client.create_host_config(log_config=log_config) ) expected_msg = "logger: no log driver named 'asdf-nope' is registered" @@ -282,6 +282,45 @@ class CreateContainerWithLogConfigTest(BaseTestCase): # raises an internal server error 500 self.client.start(container) + @unittest.skip("Reason: https://github.com/docker/docker/issues/15633") + def test_valid_no_log_driver_specified(self): + log_config = docker.utils.LogConfig( + type="", + config={'max-file': '100'} + ) + + container = self.client.create_container( + 'busybox', ['true'], + host_config=self.client.create_host_config(log_config=log_config) + ) + self.tmp_containers.append(container['Id']) + self.client.start(container) + + info = self.client.inspect_container(container) + container_log_config = info['HostConfig']['LogConfig'] + + self.assertEqual(container_log_config['Type'], "json-file") + self.assertEqual(container_log_config['Config'], log_config.config) + + def test_valid_no_config_specified(self): + log_config = docker.utils.LogConfig( + type="json-file", + config=None + ) + + container = self.client.create_container( + 'busybox', ['true'], + host_config=self.client.create_host_config(log_config=log_config) + ) + self.tmp_containers.append(container['Id']) + self.client.start(container) + + info = self.client.inspect_container(container) + container_log_config = info['HostConfig']['LogConfig'] + + self.assertEqual(container_log_config['Type'], "json-file") + self.assertEqual(container_log_config['Config'], {}) + @unittest.skipIf(not EXEC_DRIVER_IS_NATIVE, 'Exec driver not native') class TestCreateContainerReadOnlyFs(BaseTestCase): |