Exemple #1
0
 def test_result_max(self):
     sla1 = base.FailureRate({"max": 25.0})
     sla2 = base.FailureRate({"max": 75.0})
     # 50% failure rate
     for sla in [sla1, sla2]:
         sla.add_iteration({"error": ["error"]})
         sla.add_iteration({"error": []})
     self.assertFalse(sla1.result()["success"])  # 25.0% < 50.0%
     self.assertTrue(sla2.result()["success"])  # 75.0% > 50.0%
     self.assertEqual("Failed", sla1.status())
     self.assertEqual("Passed", sla2.status())
Exemple #2
0
 def test_result_min(self):
     sla1 = base.FailureRate({"min": 80.0})
     sla2 = base.FailureRate({"min": 60.5})
     # 75% failure rate
     for sla in [sla1, sla2]:
         sla.add_iteration({"error": ["error"]})
         sla.add_iteration({"error": []})
         sla.add_iteration({"error": ["error"]})
         sla.add_iteration({"error": ["error"]})
     self.assertFalse(sla1.result()["success"])  # 80.0% > 75.0%
     self.assertTrue(sla2.result()["success"])  # 60.5% < 75.0%
     self.assertEqual("Failed", sla1.status())
     self.assertEqual("Passed", sla2.status())
Exemple #3
0
 def test_add_iteration(self):
     sla = base.FailureRate({"max": 35.0})
     self.assertTrue(sla.add_iteration({"error": []}))
     self.assertTrue(sla.add_iteration({"error": []}))
     self.assertTrue(sla.add_iteration({"error": []}))
     self.assertTrue(sla.add_iteration({"error": ["error"]}))  # 33%
     self.assertFalse(sla.add_iteration({"error": ["error"]}))  # 40%
Exemple #4
0
 def test_result_min_max(self):
     sla1 = base.FailureRate({"min": 50, "max": 90})
     sla2 = base.FailureRate({"min": 5, "max": 20})
     sla3 = base.FailureRate({"min": 24.9, "max": 25.1})
     # 25% failure rate
     for sla in [sla1, sla2, sla3]:
         sla.add_iteration({"error": ["error"]})
         sla.add_iteration({"error": []})
         sla.add_iteration({"error": []})
         sla.add_iteration({"error": []})
     self.assertFalse(sla1.result()["success"])  # 25.0% < 50.0%
     self.assertFalse(sla2.result()["success"])  # 25.0% > 20.0%
     self.assertTrue(sla3.result()["success"])  # 24.9% < 25.0% < 25.1%
     self.assertEqual("Failed", sla1.status())
     self.assertEqual("Failed", sla2.status())
     self.assertEqual("Passed", sla3.status())
Exemple #5
0
 def test_result_no_iterations(self):
     sla = base.FailureRate({"max": 10.0})
     self.assertTrue(sla.result()["success"])