def test_wait(mocker, config): # pylint: disable=W0621
"""Assert runner waits before re-running the monitoring script"""
mock_execution = mocker.Mock()
mock_execution.returncode = Codes.CRITICAL.value
mocker.patch('subprocess.run', return_value=mock_execution)
mocker.patch('cachetclient.cachet.Components.put')
time_sleep = mocker.patch('time.sleep')
n_retries = 5
d_interval = 10
with pytest.raises(SystemExit):
unit.main(script=mocker.Mock(), component_id=99, config_file=config, retries=n_retries,
interval=d_interval)
expected_calls = [call(10), call(10), call(10), call(10), call(10)]
assert time_sleep.call_args_list == expected_calls
评论列表
文章目录