Beispiel #1
0
    def test_merge(self, durations):

        single_sla = outliers.Outliers({"max": 1})

        for dd in durations:
            for d in dd:
                single_sla.add_iteration({"duration": d})

        slas = [outliers.Outliers({"max": 1}) for _ in durations]

        for idx, sla in enumerate(slas):
            for duration in durations[idx]:
                sla.add_iteration({"duration": duration})

        merged_sla = slas[0]
        for sla in slas[1:]:
            merged_sla.merge(sla)

        self.assertEqual(single_sla.success, merged_sla.success)
        self.assertEqual(single_sla.iterations, merged_sla.iterations)

        # self.assertEqual(single_sla.threshold, merged_sla.threshold)

        # NOTE(ikhudoshyn): We are unable to implement
        # rally.plugins.common.sla.outliers.Outliers.merge(..) correctly
        # (see my comment for the method)
        # The assert above will fail with the majority of data
        # The line below passes with this particular data
        # but may fail as well on another data

        self.assertEqual(single_sla.outliers, merged_sla.outliers)
Beispiel #2
0
 def test_result(self):
     sla1 = outliers.Outliers({"max": 1})
     sla2 = outliers.Outliers({"max": 2})
     iteration_durations = [3.1, 4.2, 3.6, 4.5, 2.8, 3.3, 4.1, 3.8, 4.3,
                            2.9, 10.2, 11.2, 3.4]  # outliers: 10.2, 11.2
     for sla_inst in [sla1, sla2]:
         for d in iteration_durations:
             sla_inst.add_iteration({"duration": d})
     self.assertFalse(sla1.result()["success"])  # 2 outliers >  1
     self.assertTrue(sla2.result()["success"])   # 2 outliers <= 2
     self.assertEqual("Failed", sla1.status())
     self.assertEqual("Passed", sla2.status())
Beispiel #3
0
 def test_result_few_iterations_small_min_iterations(self):
     sla = outliers.Outliers({"max": 0, "min_iterations": 5})
     iteration_durations = [3.1, 4.2, 4.7, 3.6, 15.14, 2.8]
     for d in iteration_durations:
         sla.add_iteration({"duration": d})
     # NOTE(msdubov): Now this SLA can fail with >= 5 iterations
     self.assertFalse(sla.result()["success"])
Beispiel #4
0
 def test_result_few_iterations_large_min_iterations(self):
     sla = outliers.Outliers({"max": 0, "min_iterations": 10})
     iteration_durations = [3.1, 4.2, 4.7, 3.6, 15.14, 2.8]
     for d in iteration_durations:
         sla.add_iteration({"duration": d})
     # NOTE(msdubov): SLA doesn't fail because it hasn't iterations < 10
     self.assertTrue(sla.result()["success"])
Beispiel #5
0
 def test_result_large_sigmas(self):
     sla_inst = outliers.Outliers({"max": 1, "sigmas": 5})
     iteration_durations = [3.1, 4.2, 3.6, 4.5, 2.8, 3.3, 4.1, 3.8, 4.3,
                            2.9, 10.2, 11.2, 3.4]
     for d in iteration_durations:
         sla_inst.add_iteration({"duration": d})
     # NOTE(msdubov): No outliers registered since sigmas = 5 (not 2)
     self.assertTrue(sla_inst.result()["success"])
     self.assertEqual("Passed", sla_inst.status())
Beispiel #6
0
 def test_add_iteration(self):
     sla_inst = outliers.Outliers({"max": 1})
     # NOTE(msdubov): One outlier in the first 11 iterations
     first_iterations = [3.1, 4.2, 3.6, 4.5, 2.8, 3.3, 4.1, 3.8, 4.3,
                         2.9, 10.2]
     for d in first_iterations:
         self.assertTrue(sla_inst.add_iteration({"duration": d}))
     # NOTE(msdubov): 12th iteration makes the SLA always failed
     self.assertFalse(sla_inst.add_iteration({"duration": 11.2}))
     self.assertFalse(sla_inst.add_iteration({"duration": 3.4}))
Beispiel #7
0
 def test_result_no_iterations(self):
     sla = outliers.Outliers({"max": 0})
     self.assertTrue(sla.result()["success"])