Make last remaining unit tests work with Neutron by default

After this change all of nova/tests/unit should pass with
CONF.use_neutron=True by default. The functional tests still
need to be worked on but that's a later patch.

Part of blueprint use-neutron-by-default

Change-Id: I572a6e52196e0f0ddebfcda8e13550e2311cf0f1
This commit is contained in:
Matt Riedemann 2017-01-01 22:09:20 -05:00
parent a5a9713c9a
commit 41b4e456ef
3 changed files with 9 additions and 1 deletions

View File

@ -212,6 +212,9 @@ class _ComputeAPIUnitTestMixIn(object):
mock_reserve.side_effect = quota_exception
# We don't care about network validation in this test.
self.compute_api.network_api.validate_networks = (
mock.Mock(return_value=40))
with mock.patch.object(self.compute_api, '_get_image',
return_value=(image_id, {})) as mock_get_image:
for min_count, message in [(20, '20-40'), (40, '40')]:

View File

@ -995,6 +995,7 @@ class ValidateIntegerTestCase(test.NoDBTestCase):
class ValidateNeutronConfiguration(test.NoDBTestCase):
def test_nova_network(self):
self.flags(use_neutron=False)
self.assertFalse(utils.is_neutron())
def test_neutron(self):

View File

@ -390,7 +390,10 @@ class VMOpsTestCase(test_base.HyperVBaseTestCase):
@mock.patch('nova.virt.hyperv.vmops.VMOps._create_ephemerals')
@mock.patch('nova.virt.hyperv.vmops.VMOps._create_root_device')
@mock.patch('nova.virt.hyperv.vmops.VMOps._delete_disk_files')
def _test_spawn(self, mock_delete_disk_files, mock_create_root_device,
@mock.patch('nova.virt.hyperv.vmops.VMOps._get_neutron_events',
return_value=[])
def _test_spawn(self, mock_get_neutron_events,
mock_delete_disk_files, mock_create_root_device,
mock_create_ephemerals, mock_get_image_vm_gen,
mock_create_instance, mock_save_device_metadata,
mock_configdrive_required,
@ -437,6 +440,7 @@ class VMOpsTestCase(test_base.HyperVBaseTestCase):
fake_vm_gen)
mock_create_ephemerals.assert_called_once_with(
mock_instance, block_device_info['ephemerals'])
mock_get_neutron_events.assert_called_once_with(mock.sentinel.INFO)
mock_get_image_vm_gen.assert_called_once_with(mock_instance.uuid,
mock_image_meta)
mock_create_instance.assert_called_once_with(