def test_check_memory(params, meminfo, expected): copy_info = meminfo.copy() result = list(check_mem_used(params, meminfo)) assert result == expected assert copy_info == meminfo
def test_check_memory(params, meminfo, expected): copy_info = meminfo.copy() with value_store.context(CheckPluginName("mem_used_unittest"), None): result = list(check_mem_used(params, meminfo)) assert result == expected assert copy_info == meminfo
def test_check_discovery_total_zero(): """ Some containers do not provide memory info. Make sure they are discovered, and a proper error message is displayed """ section = {"MemTotal": 0} assert list(discover_mem_used(section)) == [Service()] result, = check_mem_used({}, section) assert isinstance(result, Result) assert result.state == State.UNKNOWN assert result.summary.startswith("Reported total memory is 0 B")
def test_check_memory_fails(params, meminfo, fail_with_exception): with pytest.raises(fail_with_exception): list(check_mem_used(params, meminfo))