From 5cdf30fc12a84bbb88df390a376d3ba75066b01f Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 21 Jul 2016 12:18:33 +0100 Subject: [PATCH 1/3] Teardown project and db in ResilienceTest These hold a reference to a docker.client.Client object and therefore a connection pool which leaves fds open once the test has completed. Signed-off-by: Ian Campbell --- tests/integration/resilience_test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/integration/resilience_test.py b/tests/integration/resilience_test.py index b544783a4..2a2d1b56e 100644 --- a/tests/integration/resilience_test.py +++ b/tests/integration/resilience_test.py @@ -20,6 +20,11 @@ class ResilienceTest(DockerClientTestCase): self.db.start_container(container) self.host_path = container.get_mount('/var/db')['Source'] + def tearDown(self): + del self.project + del self.db + super(ResilienceTest, self).tearDown() + def test_successful_recreate(self): self.project.up(strategy=ConvergenceStrategy.always) container = self.db.containers()[0] From 3124fec01a5c89b52dfcbbf837058e9e5635e631 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 21 Jul 2016 12:21:43 +0100 Subject: [PATCH 2/3] tearDown tmp_volumes array itself in VolumeTest Each volume in the array holds a reference to a docker.client.Client object and therefore a connection pool which leaves fds open once the test has completed. Signed-off-by: Ian Campbell --- tests/integration/volume_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/volume_test.py b/tests/integration/volume_test.py index 706179ed2..04922ccdc 100644 --- a/tests/integration/volume_test.py +++ b/tests/integration/volume_test.py @@ -17,6 +17,7 @@ class VolumeTest(DockerClientTestCase): self.client.remove_volume(volume.full_name) except DockerException: pass + del self.tmp_volumes def create_volume(self, name, driver=None, opts=None, external=None): if external and isinstance(external, bool): From d6f70dddc7376e2193ee27778f184022dec4014e Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 21 Jul 2016 12:24:24 +0100 Subject: [PATCH 3/3] Call the superclass tearDown in VolumeTest Currently it doesn't actually seem to make any practical difference that this is missing, but it seems like good practice to do so anyway, to be robust against future test case changes which might require cleanup done in the super class. Signed-off-by: Ian Campbell --- tests/integration/volume_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/volume_test.py b/tests/integration/volume_test.py index 04922ccdc..a75250ac7 100644 --- a/tests/integration/volume_test.py +++ b/tests/integration/volume_test.py @@ -18,6 +18,7 @@ class VolumeTest(DockerClientTestCase): except DockerException: pass del self.tmp_volumes + super(VolumeTest, self).tearDown() def create_volume(self, name, driver=None, opts=None, external=None): if external and isinstance(external, bool):