當前位置: 首頁>>代碼示例>>Python>>正文


Python PassFailStatus.engine方法代碼示例

本文整理匯總了Python中bzt.modules.passfail.PassFailStatus.engine方法的典型用法代碼示例。如果您正苦於以下問題:Python PassFailStatus.engine方法的具體用法?Python PassFailStatus.engine怎麽用?Python PassFailStatus.engine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bzt.modules.passfail.PassFailStatus的用法示例。


在下文中一共展示了PassFailStatus.engine方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_stop_counting_criteria

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import engine [as 別名]
    def test_stop_counting_criteria(self):
        obj = PassFailStatus()
        obj.engine = EngineEmul()
        obj.parameters = {"criteria": ["avg-rt>10ms for 2s, continue as failed"]}
        obj.prepare()
        obj.get_widget()
        start_time = time.time()

        for _n in range(0, 10):
            point = random_datapoint(start_time)
            point[DataPoint.CURRENT]['']["avg_rt"] = 1.0
            obj.aggregated_second(point)
            obj.check()
            start_time += 1

        self.assertEqual(obj.widget.text_widget.text, "Failed: avg-rt>10ms for 10 sec\n")

        for _n in range(0, 10):
            point = random_datapoint(start_time)
            point[DataPoint.CURRENT]['']["avg_rt"] = 0.01
            obj.aggregated_second(point)
            obj.check()
            start_time += 1

        self.assertEqual(obj.widget.text_widget.text, "")
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:27,代碼來源:test_passFailStatus.py

示例2: test_within

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import engine [as 別名]
    def test_within(self):
        obj = PassFailStatus()
        obj.engine = EngineEmul()
        obj.parameters = {"criteria": [
            "fail>10% within 5s",
            "fail>1000 within 5s",
            "avg-rt>100ms within 10s",
        ]}
        obj.prepare()

        start_time = time.time()
        for _n in range(0, 20):
            point = random_datapoint(start_time)
            obj.aggregated_second(point)
            if _n % 2 == 0:
                try:
                    obj.check()
                except KeyboardInterrupt:
                    pass

            try:
                obj.check()
            except KeyboardInterrupt:
                pass
            start_time += 1
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:27,代碼來源:test_passFailStatus.py

示例3: test_named_criteria

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import engine [as 別名]
 def test_named_criteria(self):
     obj = PassFailStatus()
     obj.engine = EngineEmul()
     obj.parameters = {"criteria": {"named criterion": "avg-rt of spaced label>10ms"}}
     obj.prepare()
     self.assertGreater(len(obj.criteria), 0)
     self.assertEquals(obj.criteria[0].message, "named criterion")
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:9,代碼來源:test_passFailStatus.py

示例4: test_prepare2

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import engine [as 別名]
    def test_prepare2(self):
        obj = PassFailStatus()
        obj.engine = EngineEmul()
        obj.parameters = {"criteria": ["avg-rt>10ms, continue as non-failed"]}
        obj.prepare()
        self.assertGreater(len(obj.criteria), 0)

        for n in range(0, 10):
            point = random_datapoint(n)
            obj.aggregated_second(point)
            obj.check()

        obj.post_process()
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:15,代碼來源:test_passFailStatus.py

示例5: test_passfail_crash

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import engine [as 別名]
 def test_passfail_crash(self):
     passfail = BetterDict()
     passfail.merge({
         "module": "passfail",
         "criteria": [
             "fail>10% within 5s",
         ]
     })
     obj = PassFailStatus()
     obj.engine = EngineEmul()
     obj.parameters = passfail
     obj.engine.config.merge({
         "services": [passfail],
     })
     obj.prepare()
     self.assertTrue(all(isinstance(obj, dict) for obj in passfail["criteria"]))
     self.assertTrue(all(isinstance(obj, dict) for obj in passfail["criterias"]))
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:19,代碼來源:test_passFailStatus.py

示例6: test_ashort_data

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import engine [as 別名]
    def test_ashort_data(self):
        obj = PassFailStatus()
        obj.engine = EngineEmul()

        crit_cfg = DataCriterion.string_to_config("failures>0%, stop as failed")
        obj.criteria.append(DataCriterion(crit_cfg, obj))

        point = DataPoint(0)
        point[DataPoint.CUMULATIVE] = {}
        point[DataPoint.CUMULATIVE][''] = {}
        point[DataPoint.CUMULATIVE][''][KPISet.FAILURES] = 100 * 16
        point[DataPoint.CUMULATIVE][''][KPISet.SAMPLE_COUNT] = 100 * 16

        obj.check()
        obj.shutdown()
        obj.aggregated_second(point)
        self.assertRaises(AutomatedShutdown, obj.post_process)
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:19,代碼來源:test_passFailStatus.py

示例7: test_prepare3

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import engine [as 別名]
    def test_prepare3(self):
        obj = PassFailStatus()
        obj.engine = EngineEmul()
        obj.parameters = {"criteria": ["avg-rt>10ms for 3s, continue as failed"]}
        obj.prepare()
        self.assertGreater(len(obj.criteria), 0)

        for n in range(0, 10):
            point = random_datapoint(n)
            point[DataPoint.CURRENT][''][KPISet.AVG_RESP_TIME] = 1
            obj.aggregated_second(point)
            obj.check()

        try:
            obj.post_process()
            self.fail()
        except AutomatedShutdown:
            pass
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:20,代碼來源:test_passFailStatus.py

示例8: test_percentiles_track

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import engine [as 別名]
    def test_percentiles_track(self):
        obj = PassFailStatus()
        obj.engine = EngineEmul()
        obj.parameters = {"criteria": ["p90>0ms"]}
        obj.prepare()
        self.assertGreater(len(obj.criteria), 0)

        for n in range(0, 10):
            point = random_datapoint(n)
            obj.aggregated_second(point)
            obj.check()

        obj.shutdown()
        try:
            obj.post_process()
            self.fail()
        except AutomatedShutdown:
            pass
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:20,代碼來源:test_passFailStatus.py

示例9: test_cumulative_criteria_post_process

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import engine [as 別名]
    def test_cumulative_criteria_post_process(self):
        obj = PassFailStatus()
        obj.engine = EngineEmul()
        obj.parameters = {"criteria": [
            "p90>0ms, continue as failed",
            "avg-rt>0ms, continue as failed",
        ]}
        obj.prepare()
        self.assertEquals(len(obj.criteria), 2)

        for n in range(0, 10):
            point = random_datapoint(n)
            obj.aggregated_second(point)
            obj.check()

        obj.shutdown()
        self.assertRaises(AutomatedShutdown, obj.post_process)
        for crit in obj.criteria:
            self.assertTrue(crit.is_triggered)
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:21,代碼來源:test_passFailStatus.py

示例10: test_prepare

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import engine [as 別名]
    def test_prepare(self):
        obj = PassFailStatus()
        obj.engine = EngineEmul()
        config = json.loads(open(__dir__() + "/../json/passfail.json").read())
        obj.parameters = config['reporting'][0]
        obj.prepare()
        self.assertGreater(len(obj.criteria), 0)

        for n in range(0, 10):
            point = random_datapoint(n)
            logging.info("%s: %s", n, point)
            obj.aggregated_second(point)
            try:
                obj.check()
            except AutomatedShutdown:
                pass

        try:
            obj.post_process()
        except AutomatedShutdown:
            pass
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:23,代碼來源:test_passFailStatus.py

示例11: test_prepare_label_issue

# 需要導入模塊: from bzt.modules.passfail import PassFailStatus [as 別名]
# 或者: from bzt.modules.passfail.PassFailStatus import engine [as 別名]
    def test_prepare_label_issue(self):
        # https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/codename-taurus/PWjU7xVucZ0/WkjUAbE1EwAJ
        obj = PassFailStatus()
        obj.engine = EngineEmul()
        obj.parameters = {"criteria": ["avg-rt of spaced label>10ms"]}
        obj.prepare()
        self.assertGreater(len(obj.criteria), 0)

        for n in range(0, 10):
            point = random_datapoint(n)
            point[DataPoint.CUMULATIVE]['spaced label'] = point[DataPoint.CUMULATIVE]['']
            point[DataPoint.CURRENT]['spaced label'] = point[DataPoint.CURRENT]['']
            obj.aggregated_second(point)
            obj.check()

        obj.shutdown()

        try:
            obj.post_process()
            self.fail()
        except AutomatedShutdown:
            pass
開發者ID:PurdyForks,項目名稱:taurus,代碼行數:24,代碼來源:test_passFailStatus.py


注:本文中的bzt.modules.passfail.PassFailStatus.engine方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。