def testHeartbeat(self): lm = LoadMetrics() lm.update("1.1.1.1", {"CPU": 2}, {"CPU": 1}) lm.mark_active("2.2.2.2") assert "1.1.1.1" in lm.last_heartbeat_time_by_ip assert "2.2.2.2" in lm.last_heartbeat_time_by_ip assert "3.3.3.3" not in lm.last_heartbeat_time_by_ip
def testHeartbeat(self): lm = LoadMetrics() lm.update("1.1.1.1", {"CPU": 2}, {"CPU": 1}) lm.mark_active("2.2.2.2") self.assertIn("1.1.1.1", lm.last_heartbeat_time_by_ip) self.assertIn("2.2.2.2", lm.last_heartbeat_time_by_ip) self.assertNotIn("3.3.3.3", lm.last_heartbeat_time_by_ip)