Esempio n. 1
0
def fixture_local_test_hosts(web, site):
    site.makedirs("var/check_mk/agent_output/")

    web.add_hosts([
        ("test-host", "", {
            "ipaddress": "127.0.0.1",
        }),
        ("test-host2", "xy/zzz", {
            "ipaddress": "127.0.0.1",
        }),
    ])

    site.write_file(
        "etc/check_mk/conf.d/local-test-hosts.mk",
        "datasource_programs.append(('cat ~/var/check_mk/agent_output/<HOST>', [], ['test-host', 'test-host2']))\n"
    )

    for hostname in ["test-host", "test-host2"]:
        site.write_file("var/check_mk/agent_output/%s" % hostname,
                        get_standard_linux_agent_output())

    yield

    for hostname in ["test-host", "test-host2"]:
        web.delete_host(hostname)
        site.delete_file("var/check_mk/agent_output/%s" % hostname)
    site.delete_file("etc/check_mk/conf.d/local-test-hosts.mk")
Esempio n. 2
0
def local_test_hosts(web, site):
    site.makedirs("var/check_mk/agent_output/")

    web.add_hosts([
        ("test-host", "", {
            "ipaddress": "127.0.0.1",
        }),
        ("test-host2", "xy/zzz", {
            "ipaddress": "127.0.0.1",
        }),
    ])

    site.write_file(
        "etc/check_mk/conf.d/local-test-hosts.mk",
        "datasource_programs.append(('cat ~/var/check_mk/agent_output/<HOST>', [], ['test-host', 'test-host2']))\n"
    )

    for hostname in ["test-host", "test-host2"]:
        site.write_file(
            "var/check_mk/agent_output/%s" % hostname,
            file("%s/tests/integration/cmk_base/test-files/linux-agent-output" %
                 repo_path()).read())

    yield

    for hostname in ["test-host", "test-host2"]:
        web.delete_host(hostname)
        site.delete_file("var/check_mk/agent_output/%s" % hostname)
    site.delete_file("etc/check_mk/conf.d/local-test-hosts.mk")
Esempio n. 3
0
def test_add_hosts(web):
    hosts = ["test-hosts1", "test-hosts2"]
    try:
        web.add_hosts([(hostname, "", {
            "ipaddress": "127.0.0.1",
        }) for hostname in hosts])
    finally:
        web.delete_hosts(hosts)
Esempio n. 4
0
def test_add_hosts(web):  # noqa: F811 # pylint: disable=redefined-outer-name
    hosts = ["test-hosts1", "test-hosts2"]
    try:
        web.add_hosts([(hostname, "", {
            "ipaddress": "127.0.0.1",
        }) for hostname in hosts])
    finally:
        web.delete_hosts(hosts)