def testMemoryStats(self): expected = {0: {'memPercent': 40, 'memFree': '600'}} with self._monkeyPatchedMemorySample(freeMemory='600', totalMemory='1000'): memorySample = sampling.NumaNodeMemorySample() self.assertEqual(memorySample.nodesMemSample, expected)
def testMemoryStatsWithZeroMemoryAsInt(self): expected = {0: { 'memPercent': 100, 'memFree': '0', 'hugepages': { 4: {'freePages': '5'}, 2048: {'freePages': '10'} }}} with self._monkeyPatchedMemorySample(freeMemory='0', totalMemory=0): memorySample = sampling.NumaNodeMemorySample() assert memorySample.nodesMemSample == expected
def testMemoryStatsWithZeroMemoryAsInt(self): expected = {0: {'memPercent': 100, 'memFree': '0'}} with self._monkeyPatchedMemorySample(freeMemory='0', totalMemory=0): memorySample = sampling.NumaNodeMemorySample() self.assertEqual(memorySample.nodesMemSample, expected)