]> xenbits.xensource.com Git - osstest/openstack-nova.git/commitdiff
Fix database poison warnings, part 23
authorDiana Clarke <diana.joan.clarke@gmail.com>
Fri, 28 Oct 2016 13:31:13 +0000 (09:31 -0400)
committerDiana Clarke <diana.joan.clarke@gmail.com>
Fri, 28 Oct 2016 13:31:13 +0000 (09:31 -0400)
The following warning appears in the unit test logs a number of times.

    "UserWarning: This test uses methods that set internal oslo_db
state, but it does not claim to use the database. This will conflict
with the setup of tests that do use the database and cause failures
later."

This patch fixes all the warnings (12 new ones) from:

    nova.tests.unit.virt.ironic.test_driver.py

Note that this warning is only emitted once per unit test worker, so new
offenders will show up in the logs each time you fix a test until they
are all gone.

Change-Id: I2f11c85a3fd192d93f010b781af60b78ff6914b9
Related-Bug: #1568414

nova/tests/unit/virt/ironic/test_driver.py

index e74949508c265010e9a62d1c88a147dd562e555c..a928b8cc8e2cedc606b7af590cd0b87e9fc01ebe 100644 (file)
@@ -1954,7 +1954,8 @@ class NodeCacheTestCase(test.NoDBTestCase):
 class IronicDriverConsoleTestCase(test.NoDBTestCase):
     @mock.patch.object(cw, 'IronicClientWrapper',
                        lambda *_: FAKE_CLIENT_WRAPPER)
-    def setUp(self):
+    @mock.patch.object(objects.ServiceList, 'get_all_computes_by_hv_type')
+    def setUp(self, mock_services):
         super(IronicDriverConsoleTestCase, self).setUp()
 
         self.driver = ironic_driver.IronicDriver(fake.FakeVirtAPI())