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


Python validation_mocks.get_mock_ssh_text函数代码示例

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


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

示例1: 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

示例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_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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: test_extra_nodes

def test_extra_nodes(monkeypatch, tmpdir):
    """Don't complain if there are extra nodes; the cluster might be
    scaling up.
    """
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))
    text = HEALTHY_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,代码行数:10,代码来源:test_cassandra.py

示例11: test_str

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

    str(cassandra.CassandraStatusValidation(ssh_ctx, hosts=["127.0.0.1"],
                                             cluster_name=_CLUSTER_NAME))
开发者ID:PearsonEducation,项目名称:Alarmageddon,代码行数:10,代码来源:test_cassandra.py

示例12: test_cassandra_success_with_question_marks_in_owns

def test_cassandra_success_with_question_marks_in_owns(monkeypatch, tmpdir):
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))
    text = QUESTION_MARK_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"],
                                             cluster_name=_CLUSTER_NAME)
     .perform({}))
开发者ID:PearsonEducation,项目名称:Alarmageddon,代码行数:11,代码来源:test_cassandra.py

示例13: test_stack_trace

def test_stack_trace(monkeypatch, tmpdir):
    ssh_ctx = ssh.SshContext("ubuntu", get_mock_key_file(tmpdir))
    text = """[10.198.10.174] out: Exception java.lang.RuntimeException.
    [10.198.10.174] out: 	at org.apache.cassandra.dht.Murmur3Partitioner.describeOwnership(Murmur3Partitioner.java:120)
    [10.198.10.174] out: 	at org.apache.cassandra.service.StorageService.getOwnership(StorageService.java:3512)
    [10.198.10.174] out: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    """
    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=4, hosts=["127.0.0.1"]).perform({}))
开发者ID:HelixEducation,项目名称:Alarmageddon,代码行数:12,代码来源:test_cassandra.py

示例14: 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

示例15: 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


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