From: Diana Clarke Date: Fri, 28 Oct 2016 14:56:17 +0000 (-0400) Subject: Fix database poison warnings, part 24 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f7ed4b1b99be5d6ddb300ad0f783ce9cb931ea4d;p=osstest%2Fopenstack-nova.git Fix database poison warnings, part 24 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 --- diff --git a/nova/tests/unit/compute/test_compute_mgr.py b/nova/tests/unit/compute/test_compute_mgr.py index 2712a4cf51..ab497ec142 100755 --- a/nova/tests/unit/compute/test_compute_mgr.py +++ b/nova/tests/unit/compute/test_compute_mgr.py @@ -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,