Exemplo n.º 1
0
def test_check_ssh_on_master_check_successful(mock_run):
    master = 'fake_master'
    mock_run.return_value = (0, 'fake_output')
    expected_command = 'ssh -A -n -o StrictHostKeyChecking=no %s /bin/true' % master

    actual = utils.check_ssh_on_master(master)
    mock_run.assert_called_once_with(expected_command, timeout=mock.ANY)
    assert actual == (True, None)
Exemplo n.º 2
0
def test_check_ssh_on_master_check_sudo_failure(mock_run):
    master = 'fake_master'
    mock_run.return_value = (1, 'fake_output')

    actual = utils.check_ssh_on_master(master)
    assert actual[0] is False
    assert '1' in actual[1]
    assert 'fake_output' in actual[1]
Exemplo n.º 3
0
def test_check_ssh_on_master_check_sudo_failure(mock_run):
    master = "fake_master"
    mock_run.return_value = (1, "fake_output")

    actual = utils.check_ssh_on_master(master)
    assert actual[0] is False
    assert "1" in actual[1]
    assert "fake_output" in actual[1]