Ejemplo n.º 1
0
 def test_check_instability(self):
     """Test whether a server can be considered unstable or not.
     """
     # Update/Notify and refresh, they should match.
     interval = get_time_delta(10)
     now = get_time()
     input_whens = [now, now - get_time_delta(5)]
     input_reporters = ["client:1000", "client:2000"]
     st = ErrorLog(self.server, interval, now, [], [])
     ErrorLog.add(self.server, now, "client:1000", "error")
     ErrorLog.add(self.server, now - get_time_delta(5), "client:2000",
                  "error")
     ErrorLog.add(self.server, now - get_time_delta(11), "client:3000",
                  "error")
     st.refresh()
     self.assertEqual(
         st.is_unstable(n_notifications=1,
                        n_reporters=1,
                        filter_reporter=None), True)
     self.assertEqual(
         st.is_unstable(n_notifications=2,
                        n_reporters=2,
                        filter_reporter=None), True)
     self.assertEqual(
         st.is_unstable(n_notifications=3,
                        n_reporters=2,
                        filter_reporter=None), False)
     self.assertEqual(
         st.is_unstable(n_notifications=2,
                        n_reporters=3,
                        filter_reporter=None), False)
     self.assertEqual(
         st.is_unstable(n_notifications=1,
                        n_reporters=1,
                        filter_reporter=["client:2000"]), True)
Ejemplo n.º 2
0
 def test_check_instability(self):
     """Test whether a server can be considered unstable or not.
     """
     # Update/Notify and refresh, they should match.
     interval = get_time_delta(10)
     now = get_time()
     input_whens = [ now, now - get_time_delta(5) ]
     input_reporters = [ "client:1000", "client:2000" ]
     st = ErrorLog(self.server, interval, now, [], [])
     ErrorLog.add(self.server, now, "client:1000", "error")
     ErrorLog.add(self.server, now - get_time_delta(5),
                         "client:2000", "error")
     ErrorLog.add(self.server, now - get_time_delta(11),
                         "client:3000", "error")
     st.refresh()
     self.assertEqual(
         st.is_unstable(n_notifications=1, n_reporters=1,
                        filter_reporter=None),
         True
     )
     self.assertEqual(
         st.is_unstable(n_notifications=2, n_reporters=2,
                        filter_reporter=None),
         True
     )
     self.assertEqual(
         st.is_unstable(n_notifications=3, n_reporters=2,
                        filter_reporter=None),
         False
     )
     self.assertEqual(
         st.is_unstable(n_notifications=2, n_reporters=3,
                        filter_reporter=None),
         False
     )
     self.assertEqual(
         st.is_unstable(n_notifications=1, n_reporters=1,
                        filter_reporter=["client:2000"]),
         True
     )