diff --git a/nodepool/tests/__init__.py b/nodepool/tests/__init__.py index 11536f820..f31439319 100644 --- a/nodepool/tests/__init__.py +++ b/nodepool/tests/__init__.py @@ -311,6 +311,8 @@ class BaseTestCase(testtools.TestCase): class BuilderFixture(fixtures.Fixture): + log = logging.getLogger("tests.BuilderFixture") + def __init__(self, configfile, cleanup_interval, securefile=None, num_uploaders=1): super(BuilderFixture, self).__init__() @@ -332,6 +334,13 @@ class BuilderFixture(fixtures.Fixture): self.addCleanup(self.cleanup) def cleanup(self): + # The NodePoolBuilder.stop() method does not intentionally stop the + # upload workers for reasons documented in that method. But we can + # safely do so in tests. + for worker in self.builder._upload_workers: + worker.shutdown() + worker.join() + self.log.debug("Stopped worker %s", worker.name) self.builder.stop()