Ejemplo n.º 1
0
 def test_result(self):
     sla1 = base.MaxAverageDuration(42)
     sla2 = base.MaxAverageDuration(3.62)
     for sla in [sla1, sla2]:
         sla.add_iteration({"duration": 3.14})
         sla.add_iteration({"duration": 6.28})
     self.assertTrue(sla1.result()["success"])  # 42 > avg([3.14, 6.28])
     self.assertFalse(sla2.result()["success"])  # 3.62 < avg([3.14, 6.28])
     self.assertEqual("Passed", sla1.status())
     self.assertEqual("Failed", sla2.status())
Ejemplo n.º 2
0
 def test_add_iteration(self):
     sla = base.MaxAverageDuration(4.0)
     self.assertTrue(sla.add_iteration({"duration": 3.5}))
     self.assertTrue(sla.add_iteration({"duration": 2.5}))
     self.assertTrue(sla.add_iteration({"duration": 5.0}))  # avg = 3.667
     self.assertFalse(sla.add_iteration({"duration": 7.0}))  # avg = 4.5
     self.assertTrue(sla.add_iteration({"duration": 1.0}))  # avg = 3.8
Ejemplo n.º 3
0
 def test_result_no_iterations(self):
     sla = base.MaxAverageDuration(42)
     self.assertTrue(sla.result()["success"])