]> xenbits.xensource.com Git - osstest/openstack-nova.git/commitdiff
Fix database poison warnings, part 24
authorDiana Clarke <diana.joan.clarke@gmail.com>
Fri, 28 Oct 2016 14:56:17 +0000 (10:56 -0400)
committerDiana Clarke <diana.joan.clarke@gmail.com>
Fri, 28 Oct 2016 14:56:17 +0000 (10:56 -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 (7 new ones) from:

    unit.compute.test_compute_mgr.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: Ibe23b977f24a2840eee6f8386d7c0bbbab6783fa
Related-Bug: #1568414

nova/tests/unit/compute/test_compute_mgr.py

index 2712a4cf513c1a267fd9eb8bf2a1bf4452142952..ab497ec142ee705fac622f395af87a4798d14b68 100755 (executable)
@@ -4714,6 +4714,7 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase):
         @mock.patch.object(self.instance, 'save')
         @mock.patch.object(self.compute, '_set_instance_info')
         @mock.patch.object(db, 'instance_fault_create')
+        @mock.patch.object(db, 'instance_extra_update_by_uuid')
         @mock.patch.object(objects.BlockDeviceMappingList,
                            'get_by_instance_uuid')
         @mock.patch.object(compute_utils, 'EventReporter')
@@ -4721,6 +4722,7 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase):
         def do_test(notify_about_instance_usage,
                     event_reporter,
                     get_by_instance_uuid,
+                    extra_update,
                     fault_create,
                     set_instance_info,
                     instance_save,
@@ -4762,11 +4764,15 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase):
         @mock.patch.object(self.compute.network_api, 'setup_networks_on_host')
         @mock.patch.object(self.compute.network_api, 'migrate_instance_start')
         @mock.patch.object(compute_utils, 'notify_usage_exists')
+        @mock.patch.object(compute_utils, 'EventReporter')
+        @mock.patch.object(db, 'instance_extra_update_by_uuid')
         @mock.patch.object(self.migration, 'save')
         @mock.patch.object(objects.BlockDeviceMappingList,
                            'get_by_instance_uuid')
         def do_revert_resize(mock_get_by_instance_uuid,
                              mock_migration_save,
+                             mock_extra_update,
+                             mock_event,
                              mock_notify_usage_exists,
                              mock_migrate_instance_start,
                              mock_setup_networks_on_host,
@@ -4793,12 +4799,23 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase):
         @mock.patch.object(self.compute, "_set_instance_info")
         @mock.patch.object(self.instance, 'save')
         @mock.patch.object(self.migration, 'save')
+        @mock.patch.object(compute_utils, 'EventReporter')
+        @mock.patch.object(compute_utils, 'add_instance_fault_from_exc')
+        @mock.patch.object(db, 'instance_fault_create')
+        @mock.patch.object(db, 'instance_extra_update_by_uuid')
         @mock.patch.object(self.compute.network_api, 'setup_networks_on_host')
         @mock.patch.object(self.compute.network_api, 'migrate_instance_finish')
         @mock.patch.object(self.compute.network_api, 'get_instance_nw_info')
-        def do_finish_revert_resize(mock_get_instance_nw_info,
+        @mock.patch.object(objects.BlockDeviceMappingList,
+                           'get_by_instance_uuid')
+        def do_finish_revert_resize(mock_get_by_instance_uuid,
+                                    mock_get_instance_nw_info,
                                     mock_instance_finish,
                                     mock_setup_network,
+                                    mock_extra_update,
+                                    mock_fault_create,
+                                    mock_fault_from_exc,
+                                    mock_event,
                                     mock_mig_save,
                                     mock_inst_save,
                                     mock_set,