Update for sushy 4.0.0
* Mappings used to be an implementation detail, and now they're gone. The CPU architecture handling was wrong anyway, copy it from Redfish. * Update some tests to rely on Sushy constants rather than their copies. * Mock sleep() in tests that can take a lot of time to finish. Change-Id: I681c829a806fdf2c69ad0af8bbba1b527bffb926
This commit is contained in:
@@ -110,16 +110,20 @@ class HttpsCertTestCase(testtools.TestCase):
|
||||
'The Redfish controller failed to import certificate. Error',
|
||||
self.https_cert_inst.import_certificate, 'certificate')
|
||||
|
||||
@mock.patch('time.sleep', autospec=True)
|
||||
@mock.patch.object(https_cert.HttpsCert, 'get_generate_csr_refresh',
|
||||
autospec=True)
|
||||
def test_wait_for_csr_to_create_ok(self, get_generate_csr_refresh_mock):
|
||||
def test_wait_for_csr_to_create_ok(self, get_generate_csr_refresh_mock,
|
||||
sleep_mock):
|
||||
self.cert_sign_request = 'certificate'
|
||||
self.https_cert_inst.wait_for_csr_to_create()
|
||||
self.assertTrue(get_generate_csr_refresh_mock.called)
|
||||
|
||||
@mock.patch('time.sleep', autospec=True)
|
||||
@mock.patch.object(https_cert.HttpsCert, 'get_generate_csr_refresh',
|
||||
autospec=True)
|
||||
def test_wait_for_csr_to_create_fails(self, get_generate_csr_refresh_mock):
|
||||
def test_wait_for_csr_to_create_fails(self, get_generate_csr_refresh_mock,
|
||||
sleep_mock):
|
||||
exc = exception.IloError('error')
|
||||
get_generate_csr_refresh_mock.side_effect = exc
|
||||
self.assertRaises(exception.IloError,
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
import json
|
||||
|
||||
import mock
|
||||
import sushy
|
||||
import testtools
|
||||
|
||||
from proliantutils.redfish.resources.system import constants as sys_cons
|
||||
from proliantutils.redfish.resources.system import ethernet_interface
|
||||
|
||||
|
||||
@@ -48,9 +48,8 @@ class EthernetInterfaceTestCase(testtools.TestCase):
|
||||
self.assertEqual(
|
||||
'12:44:6A:3B:04:11', self.sys_eth.permanent_mac_address)
|
||||
self.assertEqual('12:44:6A:3B:04:11', self.sys_eth.mac_address)
|
||||
self.assertEqual(sys_cons.HEALTH_STATE_ENABLED,
|
||||
self.sys_eth.status.state)
|
||||
self.assertEqual(sys_cons.HEALTH_OK, self.sys_eth.status.health)
|
||||
self.assertEqual(sushy.STATE_ENABLED, self.sys_eth.status.state)
|
||||
self.assertEqual(sushy.HEALTH_OK, self.sys_eth.status.health)
|
||||
self.assertEqual(1000, self.sys_eth.speed_mbps)
|
||||
|
||||
|
||||
|
||||
@@ -1081,7 +1081,7 @@ class RedfishOperationsTestCase(testtools.TestCase):
|
||||
count_mock = mock.PropertyMock(return_value=40)
|
||||
type(get_system_mock.return_value.processors.summary).count = (
|
||||
count_mock)
|
||||
arch_mock = mock.PropertyMock(return_value='x86 or x86-64')
|
||||
arch_mock = mock.PropertyMock(return_value=sushy.PROCESSOR_ARCH_x86)
|
||||
type(get_system_mock.return_value.processors.summary).architecture = (
|
||||
arch_mock)
|
||||
type(get_system_mock.return_value.ethernet_interfaces).summary = (
|
||||
@@ -1090,7 +1090,7 @@ class RedfishOperationsTestCase(testtools.TestCase):
|
||||
local_gb_mock.return_value = 600
|
||||
actual = self.rf_client.get_essential_properties()
|
||||
expected = {'properties': {'cpus': 40,
|
||||
'cpu_arch': 'x86',
|
||||
'cpu_arch': 'x86_64',
|
||||
'memory_mb': 20480,
|
||||
'local_gb': 600},
|
||||
'macs': {'1': '12:44:6A:3B:04:11'}}
|
||||
|
||||
Reference in New Issue
Block a user