Ejemplo n.º 1
0
def test_assert_chronos_scheduled_jobs():
    mock_client = Mock()
    mock_client.list.return_value = [
        {'name': 'myjob', 'disabled': False},
        {'name': 'myjob', 'disabled': True},
    ]
    results = metastatus_lib.assert_chronos_scheduled_jobs(mock_client)
    assert results == ('Enabled chronos jobs: 1', True)
Ejemplo n.º 2
0
def test_assert_chronos_scheduled_jobs():
    mock_client = Mock()
    mock_client.list.return_value = [
        {"name": "myjob", "disabled": False},
        {"name": "myjob", "disabled": True},
    ]
    results = metastatus_lib.assert_chronos_scheduled_jobs(mock_client)
    assert results == ("Enabled chronos jobs: 1", True)
Ejemplo n.º 3
0
def test_assert_chronos_scheduled_jobs():
    mock_client = Mock()
    mock_client.list.return_value = [
        {'name': 'myjob', 'disabled': False},
        {'name': 'myjob', 'disabled': True},
    ]
    results = metastatus_lib.assert_chronos_scheduled_jobs(mock_client)
    assert results == ('Enabled chronos jobs: 1', True)
Ejemplo n.º 4
0
def check_chronos_jobs():
    config = load_chronos_config()
    if not config:
        paasta_print("UNKNOWN: Failed to load chronos config")
        sys.exit(3)
    client = get_chronos_client(config)

    try:
        result = assert_chronos_scheduled_jobs(client)
    except (ChronosAPIError) as e:
        paasta_print("CRITICAL: Unable to connect to Chronos: %s" % e.message)
        sys.exit(2)

    if result.healthy:
        paasta_print("OK: " + result.message)
        sys.exit(0)
    else:
        paasta_print("CRITICAL: " + result.message)
        sys.exit(2)
Ejemplo n.º 5
0
def test_assert_chronos_scheduled_jobs():
    mock_client = Mock()
    mock_client.list.return_value = [{"name": "myjob", "disabled": False}, {"name": "myjob", "disabled": True}]
    results = metastatus_lib.assert_chronos_scheduled_jobs(mock_client)
    assert results == ("Enabled chronos jobs: 1", True)