当前位置: 首页>>代码示例>>Python>>正文


Python validation_mocks.get_mock_key_file函数代码示例

本文整理汇总了Python中validation_mocks.get_mock_key_file函数的典型用法代码示例。如果您正苦于以下问题:Python get_mock_key_file函数的具体用法?Python get_mock_key_file怎么用?Python get_mock_key_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_mock_key_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_load_average_disallows_generic_expections

def test_load_average_disallows_generic_expections(monkeypatch, tmpdir):
    t = "18:01:46 up 62 days, 18:27,  1 user,  load average: 0.09, 0.04, 0.05"
    monkeypatch.setattr(ssh, "run", lambda x, combine_stderr, timeout: get_mock_ssh_text(t, 0))
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))

    with pytest.raises(NotImplementedError):
        (ssh.LoadAverageValidation(ssh_ctx, hosts=hosts).expect_exit_code(1).perform({}))
开发者ID:grizzlyecollege,项目名称:Alarmageddon,代码行数:7,代码来源:test_ssh.py

示例2: test_ignore_joining_nodes

def test_ignore_joining_nodes(monkeypatch, tmpdir):
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))
    text = JOINING_NODE_OUTPUT
    monkeypatch.setattr(ssh, "run", lambda x: get_mock_ssh_text(text, 0))
    monkeypatch.setattr(cassandra, "run", lambda x: get_mock_ssh_text(text, 0))

    (cassandra.CassandraStatusValidation(ssh_ctx, number_nodes=4, hosts=["127.0.0.1"]).perform({}))
开发者ID:HelixEducation,项目名称:Alarmageddon,代码行数:7,代码来源:test_cassandra.py

示例3: test_exit_code_not_equals

def test_exit_code_not_equals(monkeypatch, tmpdir):
    t = "stopped/waiting"
    monkeypatch.setattr(ssh, "run", lambda x, combine_stderr, timeout: get_mock_ssh_text(t, 0))
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))

    with pytest.raises(ValidationFailure):
        (ssh.SshCommandValidation(ssh_ctx, "citations", "command", hosts=hosts).expect_exit_code(1).perform({}))
开发者ID:grizzlyecollege,项目名称:Alarmageddon,代码行数:7,代码来源:test_ssh.py

示例4: test_repr

def test_repr(monkeypatch, tmpdir):
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))
    text = ZERO_OWNERSHIP_OUTPUT
    monkeypatch.setattr(ssh, "run", lambda x: get_mock_ssh_text(text, 0))
    monkeypatch.setattr(cassandra, "run", lambda x: get_mock_ssh_text(text, 0))

    (cassandra.CassandraStatusValidation(ssh_ctx, hosts=["127.0.0.1"]).__repr__())
开发者ID:HelixEducation,项目名称:Alarmageddon,代码行数:7,代码来源:test_cassandra.py

示例5: test_zero_ownership_should_not_fail

def test_zero_ownership_should_not_fail(monkeypatch, tmpdir):
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))
    text = ZERO_OWNERSHIP_OUTPUT
    monkeypatch.setattr(ssh, "run", lambda x: get_mock_ssh_text(text, 0))
    monkeypatch.setattr(cassandra, "run", lambda x: get_mock_ssh_text(text, 0))

    (cassandra.CassandraStatusValidation(ssh_ctx, hosts=["127.0.0.1"]).perform({}))
开发者ID:HelixEducation,项目名称:Alarmageddon,代码行数:7,代码来源:test_cassandra.py

示例6: test_cassandra_success_without_percent_signs

def test_cassandra_success_without_percent_signs(monkeypatch, tmpdir):
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))
    text = HEALTHY_OUTPUT_WITHOUT_PERCENT_SIGNS
    monkeypatch.setattr(ssh, "run", lambda x: get_mock_ssh_text(text, 0))
    monkeypatch.setattr(cassandra, "run", lambda x: get_mock_ssh_text(text, 0))

    (cassandra.CassandraStatusValidation(ssh_ctx, hosts=["127.0.0.1"]).perform({}))
开发者ID:HelixEducation,项目名称:Alarmageddon,代码行数:7,代码来源:test_cassandra.py

示例7: test_ssh_expected_rejects_0_when_changed

def test_ssh_expected_rejects_0_when_changed(monkeypatch, tmpdir):
    t = "18:01:46 up 62 days, 18:27,  1 user,  load average: 0.09, 0.04, 0.05"
    monkeypatch.setattr(ssh, "run", lambda x, combine_stderr, timeout: get_mock_ssh_text(t, 0))
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))

    with pytest.raises(ValidationFailure):
        (ssh.SshCommandValidation(ssh_ctx, "name", "cmd", hosts=hosts).expect_exit_code(1).perform({}))
开发者ID:grizzlyecollege,项目名称:Alarmageddon,代码行数:7,代码来源:test_ssh.py

示例8: test_str

def test_str(monkeypatch, tmpdir):
    t = "18:01:46 up 62 days, 18:27,  1 user,  load average: 0.09, 0.04, 0.05"
    monkeypatch.setattr(ssh, "run",
                        lambda x, combine_stderr, timeout: get_mock_ssh_text(t, 0))
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))

    str(ssh.SshCommandValidation(ssh_ctx, "name", "cmd", hosts=hosts))
开发者ID:PearsonEducation,项目名称:Alarmageddon,代码行数:7,代码来源:test_ssh.py

示例9: test_output_correct_on_ssh_failure

def test_output_correct_on_ssh_failure(monkeypatch, tmpdir):
    monkeypatch.setattr(ssh, "run", lambda x, combine_stderr, timeout: broken_ssh())
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))

    with pytest.raises(ValidationFailure):
        validation = ssh.SshCommandValidation(ssh_ctx, "citations", "command", hosts=hosts)
        validation.add_expectation(ssh.OutputLessThan(validation, 90))
        validation.perform({})
开发者ID:grizzlyecollege,项目名称:Alarmageddon,代码行数:8,代码来源:test_ssh.py

示例10: test_output_less_than

def test_output_less_than(monkeypatch, tmpdir):
    t = "100"
    monkeypatch.setattr(ssh, "run", lambda x, combine_stderr, timeout: get_mock_ssh_text(t, 0))
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))

    validation = ssh.SshCommandValidation(ssh_ctx, "citations", "command", hosts=hosts)
    validation.add_expectation(ssh.OutputLessThan(validation, 110))
    validation.perform({})
开发者ID:grizzlyecollege,项目名称:Alarmageddon,代码行数:8,代码来源:test_ssh.py

示例11: test_max_load_correctly_fails_5_minute

def test_max_load_correctly_fails_5_minute(monkeypatch, tmpdir):
    t = "18:01:46 up 62 days, 18:27,  1 user,  load average: 0.09, 30.04, 0.05"
    monkeypatch.setattr(ssh, "run", lambda x: get_mock_ssh_text(t, 0))
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))
    with pytest.raises(ValidationFailure):
        (ssh.LoadAverageValidation(ssh_ctx, hosts=hosts)
         .expect_max_5_minute_load(20)
         .perform({}))
开发者ID:4everinbeta,项目名称:Alarmageddon,代码行数:8,代码来源:test_ssh.py

示例12: test_service_state

def test_service_state(monkeypatch, tmpdir):
    t = "running"
    monkeypatch.setattr(ssh, "sudo",
                        lambda x, combine_stderr, timeout: get_mock_ssh_text(t, 0))
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))

    (ssh.UpstartServiceValidation(ssh_ctx, "citations", hosts=hosts)
     .perform({}))
开发者ID:4everinbeta,项目名称:Alarmageddon,代码行数:8,代码来源:test_ssh.py

示例13: test_cassandra_threshold

def test_cassandra_threshold(monkeypatch, tmpdir):
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))
    text = UNBALANCED_RING_OUTPUT
    monkeypatch.setattr(ssh, "run", lambda x: get_mock_ssh_text(text, 0))
    monkeypatch.setattr(cassandra, "run", lambda x: get_mock_ssh_text(text, 0))

    with pytest.raises(ValidationFailure):
        (cassandra.CassandraStatusValidation(ssh_ctx, owns_threshold=40, hosts=["127.0.0.1"]).perform({}))
开发者ID:HelixEducation,项目名称:Alarmageddon,代码行数:8,代码来源:test_cassandra.py

示例14: test_cassandra_down

def test_cassandra_down(monkeypatch, tmpdir):
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))
    text = SERVER_DOWN_OUTPUT
    monkeypatch.setattr(ssh, "run", lambda x: get_mock_ssh_text(text, 0))
    monkeypatch.setattr(cassandra, "run", lambda x: get_mock_ssh_text(text, 0))

    with pytest.raises(ValidationFailure):
        (cassandra.CassandraStatusValidation(ssh_ctx, hosts=["127.0.0.1"]).perform({}))
开发者ID:HelixEducation,项目名称:Alarmageddon,代码行数:8,代码来源:test_cassandra.py

示例15: test_cassandra_node_count

def test_cassandra_node_count(monkeypatch, tmpdir):
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))
    text = MISSING_NODE_OUTPUT
    monkeypatch.setattr(ssh, "run", lambda x: get_mock_ssh_text(text, 0))
    monkeypatch.setattr(cassandra, "run", lambda x: get_mock_ssh_text(text, 0))

    with pytest.raises(ValidationFailure):
        (cassandra.CassandraStatusValidation(ssh_ctx, number_nodes=5, hosts=["127.0.0.1"]).perform({}))
开发者ID:HelixEducation,项目名称:Alarmageddon,代码行数:8,代码来源:test_cassandra.py


注:本文中的validation_mocks.get_mock_key_file函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。