mirror of
https://opendev.org/openstack/ironic.git
synced 2026-01-16 23:01:47 +00:00
Fix snmp unit test
Under some condition, some code underneath `snmp` power driver
seems to call `sleep` for its own reason. That fails sleep
mock call assertion:
AssertionError: Expected 'sleep' to be called once. Called 8 times.
Calls: [call(0), call(0), call(0), ... call(0), call(5)].
This fix asserts just the sleep call we expect.
Change-Id: I2edec4cbea2d39910f1fb52b0373169c03a4ec0d
This commit is contained in:
parent
acfc2ea440
commit
2a6b74b558
1 changed files with 2 additions and 1 deletions
|
|
@ -1062,7 +1062,8 @@ class SNMPDeviceDriverTestCase(db_base.DbTestCase):
|
|||
calls = [mock.call(driver._snmp_oid())] * 2
|
||||
mock_client.get.assert_has_calls(calls)
|
||||
self.assertEqual(states.POWER_ON, pstate)
|
||||
mock_sleep.assert_called_once_with(5)
|
||||
calls = [mock.call(5)]
|
||||
mock_sleep.assert_has_calls(calls)
|
||||
|
||||
def test_power_reset_on_snmp_get_failure(self, mock_get_client):
|
||||
# Ensure SNMP failure exceptions raised during a reset power on get
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue