From bb50cd7850c2208ecb1b16a527423b745122aada Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Tue, 6 Oct 2015 16:53:31 -0400 Subject: [PATCH] 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 --- cinder/tests/unit/test_backup_swift.py | 5 +++++ 1 file changed, 5 insertions(+) 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', -- 2.45.2