Ejemplo n.º 1
0
 def test_add_throughput_event_flush(self):
     self.assertEqual(1, throughput_statistics.reset)
     self.assertEqual(0, throughput_statistics.interval_data.total_in)
     throughput_statistics.add_event(Direction.INBOUND, "mock_msg", 100, "localhost 0000")
     self.assertEqual(100, throughput_statistics.interval_data.total_in)
     throughput_statistics.flush_info()
     self.assertEqual(0, throughput_statistics.interval_data.total_in)
Ejemplo n.º 2
0
 def test_adding_ping_event(self):
     add_throughput_event(Direction.INBOUND,"ping", 40, "localhost 0000")
     add_measurement("localhost 0000", MeasurementType.PING, 0.1)
     add_measurement("localhost 0000", MeasurementType.PING, 0.3)
     add_measurement("localhost 0000", MeasurementType.PING, 0.2)
     self.assertEqual(throughput_statistics.interval_data.peer_to_stats["localhost 0000"].ping_max, 0.3)
     throughput_statistics.flush_info()
 def test_adding_ping_outbound_event(self):
     add_measurement("localhost 0000", MeasurementType.PING_OUTGOING, 0.1)
     add_measurement("localhost 0000", MeasurementType.PING_OUTGOING, 0.3)
     add_measurement("localhost 0000", MeasurementType.PING_OUTGOING, 0.2)
     self.assertEqual(
         throughput_statistics.interval_data.
         peer_to_stats["localhost 0000"].ping_outgoing_max, 0.3)
     throughput_statistics.flush_info()