From: Eric Harney Date: Tue, 6 Oct 2015 20:53:31 +0000 (-0400) Subject: Test_backup_swift: Don't leak notifications X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=bb50cd7850c2208ecb1b16a527423b745122aada;p=openstack-build%2Fcinder-build.git Test_backup_swift: Don't leak notifications At least some of these tests can leak notifications such as backup.createprogress. Mock the send notification methods to ensure this doesn't happen. This likely indicates that some restructuring of these tests is needed, but patching this long-standing issue on its own is worthwhile. Partial-Bug: #1501745 Change-Id: I91cb3bef18a8b830fcc3b3589afe6b6975bc0c2b --- diff --git a/cinder/tests/unit/test_backup_swift.py b/cinder/tests/unit/test_backup_swift.py index 69a65c695..ca1eef6ce 100644 --- a/cinder/tests/unit/test_backup_swift.py +++ b/cinder/tests/unit/test_backup_swift.py @@ -105,6 +105,11 @@ class BackupSwiftTestCase(test.TestCase): for _i in range(0, 64): self.volume_file.write(os.urandom(1024)) + notify_patcher = mock.patch( + 'cinder.volume.utils.notify_about_backup_usage') + notify_patcher.start() + self.addCleanup(notify_patcher.stop) + def test_backup_swift_url(self): self.ctxt.service_catalog = [{u'type': u'object-store', u'name': u'swift',