diff options
Diffstat (limited to 'ironic_python_agent/tests')
| -rw-r--r-- | ironic_python_agent/tests/unit/extensions/test_standby.py | 8 | ||||
| -rw-r--r-- | ironic_python_agent/tests/unit/test_utils.py | 31 |
2 files changed, 8 insertions, 31 deletions
diff --git a/ironic_python_agent/tests/unit/extensions/test_standby.py b/ironic_python_agent/tests/unit/extensions/test_standby.py index 97dffbe8..559a15bb 100644 --- a/ironic_python_agent/tests/unit/extensions/test_standby.py +++ b/ironic_python_agent/tests/unit/extensions/test_standby.py @@ -1385,15 +1385,15 @@ class TestStandbyExtension(base.IronicAgentTest): self.agent_extension._sync_clock() - calls = [mock.call('chronyd', check_exit_code=[0, 1]), - mock.call('chronyc', 'add', 'server', '192.168.1.1'), - mock.call('chronyc', 'makestep'), + calls = [mock.call('chronyc', 'shutdown', check_exit_code=[0, 1]), + mock.call("chronyd -q 'server 192.168.1.1 iburst'", + shell=True), mock.call('hwclock', '-v', '--systohc')] execute_mock.assert_has_calls(calls) execute_mock.reset_mock() execute_mock.side_effect = [ - ('', ''), ('', ''), ('', ''), + ('', ''), ('', ''), processutils.ProcessExecutionError('boop') ] diff --git a/ironic_python_agent/tests/unit/test_utils.py b/ironic_python_agent/tests/unit/test_utils.py index eb6520f0..bfad67f0 100644 --- a/ironic_python_agent/tests/unit/test_utils.py +++ b/ironic_python_agent/tests/unit/test_utils.py @@ -856,27 +856,8 @@ class TestClockSyncUtils(ironic_agent_base.IronicAgentTest): mock_time_method.return_value = 'chronyd' utils.sync_clock() mock_execute.assert_has_calls([ - mock.call('chronyd', check_exit_code=[0, 1]), - mock.call('chronyc', 'add', 'server', '192.168.1.1'), - mock.call('chronyc', 'makestep'), - ]) - - @mock.patch.object(utils, 'determine_time_method', autospec=True) - def test_sync_clock_chrony_already_present(self, mock_time_method, - mock_execute): - self.config(ntp_server='192.168.1.1') - mock_time_method.return_value = 'chronyd' - mock_execute.side_effect = [ - ('', ''), - processutils.ProcessExecutionError( - stderr='Source already present'), - ('', ''), - ] - utils.sync_clock() - mock_execute.assert_has_calls([ - mock.call('chronyd', check_exit_code=[0, 1]), - mock.call('chronyc', 'add', 'server', '192.168.1.1'), - mock.call('chronyc', 'makestep'), + mock.call('chronyc', 'shutdown', check_exit_code=[0, 1]), + mock.call("chronyd -q 'server 192.168.1.1 iburst'", shell=True), ]) @mock.patch.object(utils, 'determine_time_method', autospec=True) @@ -889,12 +870,8 @@ class TestClockSyncUtils(ironic_agent_base.IronicAgentTest): processutils.ProcessExecutionError(stderr='time verboten'), ] self.assertRaisesRegex(errors.CommandExecutionError, - 'Error occured adding ntp', - utils.sync_clock) - mock_execute.assert_has_calls([ - mock.call('chronyd', check_exit_code=[0, 1]), - mock.call('chronyc', 'add', 'server', '192.168.1.1'), - ]) + 'Failed to sync time using chrony to ntp ' + 'server:', utils.sync_clock) @mock.patch.object(utils, 'determine_time_method', autospec=True) def test_sync_clock_none(self, mock_time_method, mock_execute): |
