]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Test_backup_swift: Don't leak notifications
authorEric Harney <eharney@redhat.com>
Tue, 6 Oct 2015 20:53:31 +0000 (16:53 -0400)
committerEric Harney <eharney@goesboink.net>
Wed, 7 Oct 2015 05:29:54 +0000 (01:29 -0400)
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

index 69a65c69533e5e1a9beae79e61f26b0a5b93539a..ca1eef6ce04baaf860ab5889b92f6744ea659022 100644 (file)
@@ -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',