当前位置: 首页>>代码示例>>Python>>正文


Python PBenchExecutor.check方法代码示例

本文整理汇总了Python中bzt.modules.pbench.PBenchExecutor.check方法的典型用法代码示例。如果您正苦于以下问题:Python PBenchExecutor.check方法的具体用法?Python PBenchExecutor.check怎么用?Python PBenchExecutor.check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bzt.modules.pbench.PBenchExecutor的用法示例。


在下文中一共展示了PBenchExecutor.check方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_widget

# 需要导入模块: from bzt.modules.pbench import PBenchExecutor [as 别名]
# 或者: from bzt.modules.pbench.PBenchExecutor import check [as 别名]
 def test_widget(self):
     obj = PBenchExecutor()
     obj.engine = EngineEmul()
     obj.settings = BetterDict()
     obj.engine.config.merge({
         "provisioning": "test",
         ScenarioExecutor.EXEC: [
             {
                 "throughput": 10,
                 "hold-for": 30,
                 "scenario": {
                     "default-address": "http://blazedemo.com/",
                     "requests": ["/"]
                 }
             }
         ]})
     obj.execution = obj.engine.config['execution'][0]
     obj.settings.merge({
         "path": os.path.join(os.path.dirname(__file__), '..', "phantom.sh"),
     })
     obj.prepare()
     obj.startup()
     obj.get_widget()
     self.assertTrue(isinstance(obj.widget.progress, urwid.ProgressBar))
     self.assertEqual(obj.widget.duration, 30)
     self.assertEqual(obj.widget.widgets[0].text, "Target: http://blazedemo.com:80")
     obj.check()
     obj.shutdown()
开发者ID:SanjeebJena,项目名称:taurus,代码行数:30,代码来源:test_pbench.py

示例2: test_simple

# 需要导入模块: from bzt.modules.pbench import PBenchExecutor [as 别名]
# 或者: from bzt.modules.pbench.PBenchExecutor import check [as 别名]
        def test_simple(self):
            obj = PBenchExecutor()
            obj.engine = EngineEmul()
            obj.engine.aggregator = ConsolidatingAggregator()
            obj.engine.aggregator.add_listener(DataPointLogger())
            obj.engine.config.merge({"provisioning": "test"})

            if os.path.exists("/home/undera/Sources/phantom"):  # FIXME: not good, get rid of it
                obj.settings.merge(
                    {
                        "path": "/home/undera/Sources/phantom/bin/phantom",
                        "modules-path": "/home/undera/Sources/phantom/lib/phantom",
                    }
                )
            else:
                obj.settings.merge({"path": os.path.join(os.path.dirname(__file__), "..", "phantom.sh")})

            obj.execution.merge(
                {
                    "log-responses": "proto_error",
                    # "iterations": 5000000,
                    "concurrency": 10,
                    "throughput": 1000,
                    "ramp-up": "1m",
                    # "steps": 5,
                    "hold-for": "15",
                    "scenario": {
                        "timeout": 1,
                        "default-address": "http://localhost:33",
                        "headers": {"Connection": "close"},
                        "requests": [
                            # "/",
                            {
                                "url": "/api",
                                "method": "POST",
                                "headers": {"Content-Length": 0},
                                "body": {"param": "value"},
                            }
                        ],
                    },
                }
            )
            obj.engine.aggregator.prepare()
            obj.prepare()

            obj.engine.aggregator.startup()
            obj.startup()

            while not obj.check():
                logging.debug("Running...")
                obj.engine.aggregator.check()
                time.sleep(1)

            obj.shutdown()
            obj.engine.aggregator.shutdown()

            obj.post_process()
            obj.engine.aggregator.post_process()
开发者ID:VegiS,项目名称:taurus,代码行数:60,代码来源:test_pbench.py


注:本文中的bzt.modules.pbench.PBenchExecutor.check方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。