def test_get_chronos_status():
    client = Mock()
    client.list.return_value = [{"name": "fake_job1", "disabled": False}, {"name": "fake_job2", "disabled": False}]
    expected_jobs_output = ("Enabled chronos jobs: 2", True)
    results = paasta_metastatus.get_chronos_status(client)

    assert expected_jobs_output in results
def test_get_chronos_status():
    client = Mock()
    client.list.return_value = [
        {'name': 'fake_job1', 'disabled': False},
        {'name': 'fake_job2', 'disabled': False},
    ]
    expected_jobs_output = ("Enabled chronos jobs: 2", True)
    results = paasta_metastatus.get_chronos_status(client)

    assert expected_jobs_output in results
예제 #3
0
def test_get_chronos_status_no_chronos():
    """ Asserts that chronos checks return ok, even when chronos
        is not available. This needs to be removed and fixed when
        we have chronos available everywhere, but worth verifying
        it works as expected for now """
    mock_client = Mock()
    mock_client.list.side_effect = ServerNotFoundError

    results = paasta_metastatus.get_chronos_status(mock_client)
    assert results == [("Enabled chronos jobs: 0", True)]
예제 #4
0
def test_get_chronos_status():
    client = Mock()
    client.list.return_value = [
        {'name': 'fake_job1', 'disabled': False},
        {'name': 'fake_job2', 'disabled': False},
    ]
    expected_jobs_output = ("Enabled chronos jobs: 2", True)
    results = paasta_metastatus.get_chronos_status(client)

    assert expected_jobs_output in results
예제 #5
0
def test_get_chronos_status_no_chronos():
    """ Asserts that chronos checks return ok, even when chronos
        is not available. This needs to be removed and fixed when
        we have chronos available everywhere, but worth verifying
        it works as expected for now """
    mock_client = Mock()
    mock_client.list.side_effect = ServerNotFoundError

    results = paasta_metastatus.get_chronos_status(mock_client)
    assert results == [('Enabled chronos jobs: 0', True)]
예제 #6
0
def test_get_chronos_status(mock_queued_jobs, mock_scheduled_jobs):
    mock_scheduled_jobs_result = paasta_metastatus.HealthCheckResult(
        message='Enabled chronos jobs: 1', healthy=True)
    mock_queued_jobs_result = paasta_metastatus.HealthCheckResult(
        message="Jobs Queued: 0 (0%)", healthy=True)
    mock_queued_jobs.return_value = mock_queued_jobs_result
    mock_scheduled_jobs.return_value = mock_scheduled_jobs_result

    expected_results = [mock_queued_jobs_result, mock_scheduled_jobs_result]

    assert paasta_metastatus.get_chronos_status(Mock()) == expected_results