def test_failing_memory_health():
    failure_metrics = {
        'master/mem_total': 1024,
        'master/mem_used': 1000,
    }
    failure_output, failure_health = paasta_metastatus.assert_memory_health(failure_metrics)
    assert not failure_health
    assert PaastaColors.red("CRITICAL: Less than 10% memory available. (Currently using 97.66%)") in failure_output
Esempio n. 2
0
def assert_memory_health_mesos_reports_zero():
    mesos_metrics = {
        'master/mem_total': 0,
        'master/mem_used': 1,
    }
    failure_output, failure_health = paasta_metastatus.assert_memory_health(mesos_metrics)
    assert failure_output == "Error reading total available memory from mesos!"
    assert failure_health is False
def test_assert_memory_health():
    ok_metrics = {
        'master/mem_total': 1024,
        'master/mem_used': 512,
    }
    ok_output, ok_health = paasta_metastatus.assert_memory_health(ok_metrics)
    assert ok_health
    assert "Memory: 0.50 / 1.00GB in use (%s)" % PaastaColors.green("50.00%") in ok_output
Esempio n. 4
0
def test_failing_memory_health():
    failure_metrics = {
        'master/mem_total': 1024,
        'master/mem_used': 1000,
    }
    failure_output, failure_health = paasta_metastatus.assert_memory_health(failure_metrics)
    assert not failure_health
    assert PaastaColors.red("CRITICAL: Less than 10% memory available. (Currently using 97.66%)") in failure_output
Esempio n. 5
0
def test_assert_memory_health():
    ok_metrics = {
        'master/mem_total': 1024,
        'master/mem_used': 512,
    }
    ok_output, ok_health = paasta_metastatus.assert_memory_health(ok_metrics)
    assert ok_health
    assert "Memory: 0.50 / 1.00GB in use (%s)" % PaastaColors.green("50.00%") in ok_output
Esempio n. 6
0
def assert_memory_health_mesos_reports_zero():
    mesos_metrics = {
        'master/mem_total': 0,
        'master/mem_used': 1,
    }
    failure_output, failure_health = paasta_metastatus.assert_memory_health(
        mesos_metrics)
    assert failure_output == "Error reading total available memory from mesos!"
    assert failure_health is False
Esempio n. 7
0
def test_failing_memory_health():
    failure_metrics = {
        'master/mem_total': 1024,
        'master/mem_used': 500,
    }
    fake_mesos_state = {
        'slaves': [
            {
                'reserved_resources': {
                    'some-role': {
                        'mem': 500,
                    },
                },
            },
        ],
    }
    failure_output, failure_health = paasta_metastatus.assert_memory_health(
        failure_metrics, fake_mesos_state)
    assert not failure_health
    assert "CRITICAL: Less than 10% memory available. (Currently using 97.66% of 1.00GB)" in failure_output
Esempio n. 8
0
def test_assert_memory_health():
    ok_metrics = {
        'master/mem_total': 1024,
        'master/mem_used': 256,
    }
    fake_mesos_state = {
        'slaves': [
            {
                'reserved_resources': {
                    'some-role': {
                        'mem': 256,
                    },
                },
            },
        ],
    }
    ok_output, ok_health = paasta_metastatus.assert_memory_health(
        ok_metrics, fake_mesos_state)
    assert ok_health
    assert "Memory: 0.50 / 1.00GB in use (%s)" % PaastaColors.green(
        "50.00%") in ok_output
def test_failing_memory_health():
    failure_metrics = {"master/mem_total": 1024, "master/mem_used": 1000}
    failure_output, failure_health = paasta_metastatus.assert_memory_health(failure_metrics)
    assert not failure_health
    assert "CRITICAL: Less than 10% memory available. (Currently using 97.66% of 1.00GB)" in failure_output