Update unit tests for neutron interface

Commit ab97fa0f1f added the neutron
network interface. Update unit test comments and tests to reflect
this.

Also fix two mis-spellings in two comments.

Change-Id: Ic532f7d30842394715ba55f38a2ccd7837d3c263
This commit is contained in:
John L. Villalovos 2016-09-07 18:18:01 -07:00
parent 0f07436861
commit f68ffba6b0
2 changed files with 14 additions and 6 deletions

View File

@ -52,7 +52,7 @@ class BaseDriver(object):
"""Indicates if a driver is supported.
This will be set to False for drivers which are untested in first- or
third-party CI, or in the proces of being deprecated.
third-party CI, or in the process of being deprecated.
"""
core_interfaces = []
@ -178,7 +178,7 @@ class BaseInterface(object):
"""Indicates if an interface is supported.
This will be set to False for interfaces which are untested in first- or
third-party CI, or in the proces of being deprecated.
third-party CI, or in the process of being deprecated.
"""
interface_type = 'base'

View File

@ -127,13 +127,15 @@ class NetworkInterfaceFactoryTestCase(db_base.DbTestCase):
@mock.patch.object(driver_factory, '_warn_if_unsupported')
def test_build_driver_for_task(self, mock_warn):
# flat and noop network interfaces are enabled in base test case
# flat, neutron, and noop network interfaces are enabled in base test
# case
factory = driver_factory.NetworkInterfaceFactory
node = obj_utils.create_test_node(self.context, driver='fake',
network_interface='flat')
with task_manager.acquire(self.context, node.id) as task:
extension_mgr = factory._extension_manager
self.assertIn('flat', extension_mgr)
self.assertIn('neutron', extension_mgr)
self.assertIn('noop', extension_mgr)
self.assertEqual(extension_mgr['flat'].obj, task.driver.network)
self.assertEqual('ironic.hardware.interfaces.network',
@ -145,18 +147,21 @@ class NetworkInterfaceFactoryTestCase(db_base.DbTestCase):
self.assertEqual(4, mock_warn.call_count)
def test_build_driver_for_task_default_is_none(self):
# flat and noop network interfaces are enabled in base test case
# flat, neutron, and noop network interfaces are enabled in base test
# case
factory = driver_factory.NetworkInterfaceFactory
self.config(dhcp_provider='none', group='dhcp')
node = obj_utils.create_test_node(self.context, driver='fake')
with task_manager.acquire(self.context, node.id) as task:
extension_mgr = factory._extension_manager
self.assertIn('flat', extension_mgr)
self.assertIn('neutron', extension_mgr)
self.assertIn('noop', extension_mgr)
self.assertEqual(extension_mgr['noop'].obj, task.driver.network)
def test_build_driver_for_task_default_network_interface_is_set(self):
# flat and noop network interfaces are enabled in base test case
# flat, neutron, and noop network interfaces are enabled in base test
# case
factory = driver_factory.NetworkInterfaceFactory
self.config(dhcp_provider='none', group='dhcp')
self.config(default_network_interface='flat')
@ -164,16 +169,19 @@ class NetworkInterfaceFactoryTestCase(db_base.DbTestCase):
with task_manager.acquire(self.context, node.id) as task:
extension_mgr = factory._extension_manager
self.assertIn('flat', extension_mgr)
self.assertIn('neutron', extension_mgr)
self.assertIn('noop', extension_mgr)
self.assertEqual(extension_mgr['flat'].obj, task.driver.network)
def test_build_driver_for_task_default_is_flat(self):
# flat and noop network interfaces are enabled in base test case
# flat, neutron, and noop network interfaces are enabled in base test
# case
factory = driver_factory.NetworkInterfaceFactory
node = obj_utils.create_test_node(self.context, driver='fake')
with task_manager.acquire(self.context, node.id) as task:
extension_mgr = factory._extension_manager
self.assertIn('flat', extension_mgr)
self.assertIn('neutron', extension_mgr)
self.assertIn('noop', extension_mgr)
self.assertEqual(extension_mgr['flat'].obj, task.driver.network)