Merge "Fix FakeBIOS to allow tempest testing"
This commit is contained in:
commit
097be73f33
@ -953,7 +953,7 @@ class BIOSInterface(BaseInterface):
|
|||||||
|
|
||||||
def wrapper(func):
|
def wrapper(func):
|
||||||
@six.wraps(func)
|
@six.wraps(func)
|
||||||
def wrapped(self, task, *args, **kwargs):
|
def wrapped(task, *args, **kwargs):
|
||||||
func(task, *args, **kwargs)
|
func(task, *args, **kwargs)
|
||||||
instance.cache_bios_settings(task)
|
instance.cache_bios_settings(task)
|
||||||
return wrapped
|
return wrapped
|
||||||
|
@ -246,6 +246,10 @@ class FakeBIOS(base.BIOSInterface):
|
|||||||
def validate(self, task):
|
def validate(self, task):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@base.clean_step(priority=0, argsinfo={
|
||||||
|
'settings': {'description': ('List of BIOS settings, each item needs '
|
||||||
|
'to contain a dictionary with name/value pairs'),
|
||||||
|
'required': True}})
|
||||||
def apply_configuration(self, task, settings):
|
def apply_configuration(self, task, settings):
|
||||||
node_id = task.node.id
|
node_id = task.node.id
|
||||||
try:
|
try:
|
||||||
@ -253,6 +257,7 @@ class FakeBIOS(base.BIOSInterface):
|
|||||||
except exception.BIOSSettingAlreadyExists:
|
except exception.BIOSSettingAlreadyExists:
|
||||||
objects.BIOSSettingList.save(task.context, node_id, settings)
|
objects.BIOSSettingList.save(task.context, node_id, settings)
|
||||||
|
|
||||||
|
@base.clean_step(priority=0)
|
||||||
def factory_reset(self, task):
|
def factory_reset(self, task):
|
||||||
node_id = task.node.id
|
node_id = task.node.id
|
||||||
setting_objs = objects.BIOSSettingList.get_by_node_id(
|
setting_objs = objects.BIOSSettingList.get_by_node_id(
|
||||||
@ -260,6 +265,7 @@ class FakeBIOS(base.BIOSInterface):
|
|||||||
for setting in setting_objs:
|
for setting in setting_objs:
|
||||||
objects.BIOSSetting.delete(task.context, node_id, setting.name)
|
objects.BIOSSetting.delete(task.context, node_id, setting.name)
|
||||||
|
|
||||||
|
@base.clean_step(priority=0)
|
||||||
def cache_bios_settings(self, task):
|
def cache_bios_settings(self, task):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -36,10 +36,10 @@ class NoInterfacesTestCase(base.TestCase):
|
|||||||
def test_bios(self):
|
def test_bios(self):
|
||||||
self.assertRaises(exception.UnsupportedDriverExtension,
|
self.assertRaises(exception.UnsupportedDriverExtension,
|
||||||
getattr(noop.NoBIOS(), 'apply_configuration'),
|
getattr(noop.NoBIOS(), 'apply_configuration'),
|
||||||
self, self.task, '')
|
self.task, '')
|
||||||
self.assertRaises(exception.UnsupportedDriverExtension,
|
self.assertRaises(exception.UnsupportedDriverExtension,
|
||||||
getattr(noop.NoBIOS(), 'factory_reset'),
|
getattr(noop.NoBIOS(), 'factory_reset'),
|
||||||
self, self.task)
|
self.task)
|
||||||
|
|
||||||
def test_console(self):
|
def test_console(self):
|
||||||
for method in ('start_console', 'stop_console', 'get_console'):
|
for method in ('start_console', 'stop_console', 'get_console'):
|
||||||
|
@ -447,7 +447,7 @@ class TestBIOSInterface(base.TestCase):
|
|||||||
bios = MyBIOSInterface()
|
bios = MyBIOSInterface()
|
||||||
task_mock = mock.MagicMock()
|
task_mock = mock.MagicMock()
|
||||||
|
|
||||||
bios.apply_configuration(bios, task_mock, "")
|
bios.apply_configuration(task_mock, "")
|
||||||
cache_bios_settings_mock.assert_called_once_with(bios, task_mock)
|
cache_bios_settings_mock.assert_called_once_with(bios, task_mock)
|
||||||
|
|
||||||
@mock.patch.object(MyBIOSInterface, 'cache_bios_settings', autospec=True)
|
@mock.patch.object(MyBIOSInterface, 'cache_bios_settings', autospec=True)
|
||||||
@ -455,7 +455,7 @@ class TestBIOSInterface(base.TestCase):
|
|||||||
bios = MyBIOSInterface()
|
bios = MyBIOSInterface()
|
||||||
task_mock = mock.MagicMock()
|
task_mock = mock.MagicMock()
|
||||||
|
|
||||||
bios.factory_reset(bios, task_mock)
|
bios.factory_reset(task_mock)
|
||||||
cache_bios_settings_mock.assert_called_once_with(bios, task_mock)
|
cache_bios_settings_mock.assert_called_once_with(bios, task_mock)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user