Пример #1
0
def test_prepare_output_critical_verbose():
    origin = {
        'message': (
            "2 partition(s) have the number of replicas in "
            "sync that is lower than the specified min ISR."
        ),
        'verbose': (
            "Partitions:\n"
            "isr=1 is lower than min_isr=3 for topic_0:0\n"
            "isr=2 is lower than min_isr=3 for topic_1:0"
        ),
        'raw': {
            'not_enough_replicas_count': 2,
            'partitions': [
                {
                    'isr': 1,
                    'min_isr': 3,
                    'partition': 0,
                    'topic': 'topic_0'
                },
                {
                    'isr': 2,
                    'min_isr': 3,
                    'partition': 0,
                    'topic': 'topic_1'
                }
            ],
        }
    }
    assert _prepare_output(NOT_IN_SYNC_PARTITIONS, True, -1) == origin
Пример #2
0
def test_prepare_output_ok_no_verbose():
    origin = {
        'message': "All replicas in sync.",
        'raw': {
            'not_enough_replicas_count': 0,
        }
    }
    assert _prepare_output([], False, -1) == origin
Пример #3
0
def test_prepare_output_ok_verbose():
    origin = {
        'message': "All replicas in sync.",
        'raw': {
            'not_enough_replicas_count': 0,
            'partitions': [],
        }
    }
    assert _prepare_output([], True, -1) == origin
Пример #4
0
def test_prepare_output_critical_no_verbose():
    origin = {
        'message': ("2 partition(s) have the number of replicas in "
                    "sync that is lower than the specified min ISR."),
        'raw': {
            'not_enough_replicas_count': 2,
        }
    }
    assert _prepare_output(NOT_IN_SYNC_PARTITIONS, False) == origin