def test_ok_marathon_apps(mock_get_all_marathon_apps):
    client = mock.Mock()
    mock_get_all_marathon_apps.return_value = [
        "MarathonApp::1", "MarathonApp::2"
    ]
    output, ok = metastatus_lib.assert_marathon_apps([client])
    assert re.match("marathon apps: +2", output)
    assert ok
示例#2
0
def test_ok_marathon_apps(mock_get_marathon_client):
    client = mock_get_marathon_client.return_value
    client.list_apps.return_value = [
        "MarathonApp::1",
        "MarathonApp::2"
    ]
    output, ok = metastatus_lib.assert_marathon_apps(client)
    assert "marathon apps: 2" in output
    assert ok
示例#3
0
def test_ok_marathon_apps(mock_get_marathon_client):
    client = mock_get_marathon_client.return_value
    client.list_apps.return_value = [
        "MarathonApp::1",
        "MarathonApp::2",
    ]
    output, ok = metastatus_lib.assert_marathon_apps(client)
    assert "marathon apps: 2" in output
    assert ok
示例#4
0
def test_ok_marathon_apps():
    client = Mock()
    client.list_apps.return_value = [
        "MarathonApp::1",
        "MarathonApp::2",
    ]
    output, ok = metastatus_lib.assert_marathon_apps([client])
    assert re.match("marathon apps: +2", output)
    assert ok
def check_marathon_apps():
    clients = marathon_tools.get_list_of_marathon_clients()
    if not clients:
        paasta_print("UNKNOWN: Failed to load marathon clients.")
        sys.exit(3)

    try:
        result = assert_marathon_apps(clients)
    except (MarathonError, InternalServerError, ValueError) as e:
        paasta_print("CRITICAL: Unable to connect to Marathon cluster: %s" % e)
        sys.exit(2)

    if result.healthy:
        paasta_print("OK: " + result.message)
        sys.exit(0)
    else:
        paasta_print(result.message)
        sys.exit(2)
def check_marathon_apps():
    config = load_marathon_config()
    if not config:
        paasta_print("UNKNOWN: Failed to load marathon config")
        sys.exit(3)
    client = get_marathon_client(config)

    try:
        result = assert_marathon_apps(client)
    except (MarathonError, InternalServerError, ValueError) as e:
        paasta_print("CRITICAL: Unable to connect to Marathon cluster: %s" %
                     e.message)
        sys.exit(2)

    if result.healthy:
        paasta_print("OK: " + result.message)
        sys.exit(0)
    else:
        paasta_print(result.message)
        sys.exit(2)
示例#7
0
def test_no_marathon_apps(mock_get_marathon_client):
    client = mock_get_marathon_client.return_value
    client.list_apps.return_value = []
    output, ok = metastatus_lib.assert_marathon_apps(client)
    assert "CRITICAL: No marathon apps running" in output
    assert not ok
示例#8
0
def test_no_marathon_apps(mock_get_marathon_client):
    client = mock_get_marathon_client.return_value
    client.list_apps.return_value = []
    output, ok = metastatus_lib.assert_marathon_apps(client)
    assert "CRITICAL: No marathon apps running" in output
    assert not ok
示例#9
0
def test_no_marathon_apps(mock_get_all_marathon_apps):
    client = mock.Mock()
    mock_get_all_marathon_apps.return_value = []
    output, ok = metastatus_lib.assert_marathon_apps([client])
    assert "CRITICAL: No marathon apps running" in output
    assert not ok