• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python validation_mocks.get_mock_key_file函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: test_no_cassandra

def test_no_cassandra(monkeypatch, tmpdir):
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))
    text = "Error connecting to remote JMX agent!"
    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


示例17: test_cassandra_success_with_percent_signs

def test_cassandra_success_with_percent_signs(monkeypatch, tmpdir):
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))
    text = UNHEALTHY_OUTPUT_WITH_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))

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


示例18: test_output_does_not_contain

def test_output_does_not_contain(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))

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


示例19: test_output_greater_than_correctly_fails

def test_output_greater_than_correctly_fails(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))

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


示例20: test_kafka_multiple_duplicate_partition

def test_kafka_multiple_duplicate_partition(monkeypatch, tmpdir):
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))
    text = "topic: topic1\tpartition: 0\tleader: 140\treplicas: 140,187,96,99,132\tisr: 140,187,96,99,132\r\ntopic: topic1\tpartition: 1\tleader: 187\treplicas: 187,96,99,132,140\tisr: 132,96,187,140,99\r\ntopic: topic1\tpartition: 2\tleader: 96\treplicas: 96,99,132,140,187\tisr: 96,99,132,140,187\r\ntopic: topic1\tpartition: 3\tleader: 99\treplicas: 99,132,140,187,96\tisr: 99,132,140,187,96\r\ntopic: topic1\tpartition: 4\tleader: 99\treplicas: 132,140,187,96,99\tisr: 132,140,187,96,99\r\ntopic: topic2\tpartition: 0\tleader: 187\treplicas: 187,96,99,132,140\tisr: 132,96,187,140,99\r\ntopic: topic2\tpartition: 1\tleader: 96\treplicas: 96,99,132,140,187\tisr: 132,96,187,140,99\r\ntopic: topic2\tpartition: 2\tleader: 99\treplicas: 99,132,140,187,96\tisr: 132,96,187,140,99\r\ntopic: topic2\tpartition: 3\tleader: 132\treplicas: 132,140,187,96,99\tisr: 132,96,187,140,99\r\ntopic: topic2\tpartition: 4\tleader: 132\treplicas: 140,187,96,99,132\tisr: 132,96,187,140,99"
    monkeypatch.setattr(kafka, "run",
                        lambda x: get_mock_ssh_text(text, 0))
    with pytest.raises(ValidationFailure):
        (kafka.KafkaStatusValidation(ssh_ctx,
                                     zookeeper_nodes="1.2.3.4:2181",
                                     hosts=["127.0.0.1"])
         .perform({}))
开发者ID:4everinbeta,项目名称:Alarmageddon,代码行数:10,代码来源:test_kafka.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python validation_mocks.get_mock_ssh_text函数代码示例发布时间:2022-05-26
下一篇:
Python validation.Validate类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap