Ejemplo n.º 1
0
 def test_global_pinger_memo(self):
   fast_pinger = Pinger(timeout=self.fast_timeout_seconds, tries=2)
   slow_pinger = Pinger(timeout=self.slow_timeout_seconds, tries=2)
   self.assertEqual(
     fast_pinger.pings([self.slow_netloc])[0][1], Pinger.UNREACHABLE, msg=self.message)
   self.assertNotEqual(
     slow_pinger.pings([self.slow_netloc])[0][1], Pinger.UNREACHABLE, msg=self.message)
Ejemplo n.º 2
0
 def test_pinger_times_correct(self):
   test = Pinger(timeout=self.slow_timeout_seconds, tries=2)
   netlocs = [self.fast_netloc, self.slow_netloc, self.unreachable_netloc]
   ping_results = dict(test.pings(netlocs))
   self.assertNotEqual(ping_results[self.slow_netloc], Pinger.UNREACHABLE)
   self.assertLess(ping_results[self.fast_netloc], ping_results[self.slow_netloc])
   self.assertEqual(ping_results[self.unreachable_netloc], Pinger.UNREACHABLE, msg=self.message)
Ejemplo n.º 3
0
 def test_pinger_timeout_config(self):
   test = Pinger(timeout=self.fast_timeout_seconds, tries=2)
   netlocs = [self.fast_netloc, self.slow_netloc]
   ping_results = dict(test.pings(netlocs))
   self.assertLess(ping_results[self.fast_netloc], self.fast_timeout_seconds)
   self.assertEqual(
     ping_results[self.slow_netloc], Pinger.UNREACHABLE, msg=self.message)
Ejemplo n.º 4
0
 def test_pinger_times_correct(self):
     test = Pinger(timeout=.5, tries=2)
     netlocs = [self.fast_netloc, self.slow_netloc, self.timeout_netloc]
     ping_results = dict(test.pings(netlocs))
     self.assertLess(ping_results[self.fast_netloc],
                     ping_results[self.slow_netloc])
     self.assertEqual(ping_results[self.timeout_netloc], Pinger.UNREACHABLE)
Ejemplo n.º 5
0
 def test_pinger_times_correct(self):
   test = Pinger(timeout=.5, tries=2)
   netlocs = [self.fast_netloc, self.slow_netloc, self.timeout_netloc]
   ping_results = dict(test.pings(netlocs))
   self.assertLess(ping_results[self.fast_netloc], ping_results[self.slow_netloc])
   self.assertEqual(ping_results[self.timeout_netloc], Pinger.UNREACHABLE)