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


Python PBenchExecutor.execution方法代码示例

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


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

示例1: test_pbench_payload_relpath

# 需要导入模块: from bzt.modules.pbench import PBenchExecutor [as 别名]
# 或者: from bzt.modules.pbench.PBenchExecutor import execution [as 别名]
        def test_pbench_payload_relpath(self):
            "Verify that enhanced pbench preserves relative script path"
            script_path = "tests/data/pbench.src"

            obj = PBenchExecutor()
            obj.engine = EngineEmul()
            obj.settings = BetterDict()
            obj.engine.config = BetterDict()
            obj.engine.config.merge({
                ScenarioExecutor.EXEC: {
                    "executor": "pbench",
                    "scenario": {"script": "tests/data/pbench.src"}
                },
                "provisioning": "test",
            })
            obj.execution = obj.engine.config['execution']
            obj.settings.merge({
                "path": os.path.join(os.path.dirname(__file__), '..', "phantom.sh"),
                "enhanced": True,
            })
            obj.prepare()

            pbench_conf = os.path.join(obj.engine.artifacts_dir, "pbench.conf")
            with open(pbench_conf) as conf_fds:
                config = conf_fds.read()
                self.assertIn(script_path, config)
开发者ID:SanjeebJena,项目名称:taurus,代码行数:28,代码来源:test_pbench.py

示例2: test_widget

# 需要导入模块: from bzt.modules.pbench import PBenchExecutor [as 别名]
# 或者: from bzt.modules.pbench.PBenchExecutor import execution [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

示例3: test_pbench_file_lister

# 需要导入模块: from bzt.modules.pbench import PBenchExecutor [as 别名]
# 或者: from bzt.modules.pbench.PBenchExecutor import execution [as 别名]
 def test_pbench_file_lister(self):
     obj = PBenchExecutor()
     obj.engine = EngineEmul()
     obj.settings = BetterDict()
     obj.engine.config = BetterDict()
     obj.engine.config.merge(
         {ScenarioExecutor.EXEC: {"executor": "pbench", "scenario": {"script": "/opt/data/script.src"}}}
     )
     obj.execution = obj.engine.config["execution"]
     obj.settings.merge({"path": os.path.join(os.path.dirname(__file__), "..", "phantom.sh")})
     resource_files = obj.resource_files()
     self.assertEqual(1, len(resource_files))
     self.assertEqual(resource_files[0], "script.src")
开发者ID:VegiS,项目名称:taurus,代码行数:15,代码来源:test_pbench.py

示例4: test_same_address_port

# 需要导入模块: from bzt.modules.pbench import PBenchExecutor [as 别名]
# 或者: from bzt.modules.pbench.PBenchExecutor import execution [as 别名]
 def test_same_address_port(self):
     obj = PBenchExecutor()
     obj.engine = EngineEmul()
     obj.settings = BetterDict()
     obj.engine.config = BetterDict()
     obj.engine.config.merge(yaml.load(open(__dir__() + "/../yaml/phantom_request_same_address.yml").read()))
     obj.execution = obj.engine.config["execution"][0]
     obj.settings.merge({"path": os.path.join(os.path.dirname(__file__), "..", "phantom.sh")})
     try:
         obj.prepare()
         self.fail()
     except ValueError:
         pass
开发者ID:VegiS,项目名称:taurus,代码行数:15,代码来源:test_pbench.py

示例5: test_pbench_payload_py3_crash

# 需要导入模块: from bzt.modules.pbench import PBenchExecutor [as 别名]
# 或者: from bzt.modules.pbench.PBenchExecutor import execution [as 别名]
 def test_pbench_payload_py3_crash(self):
     obj = PBenchExecutor()
     obj.engine = EngineEmul()
     obj.settings = BetterDict()
     obj.engine.config = BetterDict()
     obj.engine.config.merge({
         ScenarioExecutor.EXEC: {
             "executor": "pbench",
             "scenario": {"requests": ["test%d" % i for i in range(20)]}
         },
         "provisioning": "test",
     })
     obj.execution = obj.engine.config['execution']
     obj.settings.merge({
         "path": os.path.join(os.path.dirname(__file__), '..', "phantom.sh"),
     })
     obj.prepare()
开发者ID:SanjeebJena,项目名称:taurus,代码行数:19,代码来源:test_pbench.py

示例6: test_pbench_script

# 需要导入模块: from bzt.modules.pbench import PBenchExecutor [as 别名]
# 或者: from bzt.modules.pbench.PBenchExecutor import execution [as 别名]
 def test_pbench_script(self):
     obj = PBenchExecutor()
     obj.engine = EngineEmul()
     obj.settings = BetterDict()
     obj.engine.config = BetterDict()
     obj.engine.config.merge({
         ScenarioExecutor.EXEC: {
             "executor": "pbench",
             "scenario": {"script": __dir__() + "/../data/pbench.src"}
         },
         "provisioning": "test"
     })
     obj.execution = obj.engine.config['execution']
     obj.settings.merge({
         "path": os.path.join(os.path.dirname(__file__), '..', "phantom.sh"),
     })
     obj.prepare()
开发者ID:SanjeebJena,项目名称:taurus,代码行数:19,代码来源:test_pbench.py

示例7: test_improved_request_building

# 需要导入模块: from bzt.modules.pbench import PBenchExecutor [as 别名]
# 或者: from bzt.modules.pbench.PBenchExecutor import execution [as 别名]
        def test_improved_request_building(self):
            obj = PBenchExecutor()
            obj.engine = EngineEmul()
            obj.settings = BetterDict()
            obj.engine.config = BetterDict()
            obj.engine.config.merge(yaml.load(open(__dir__() + "/../yaml/phantom_improved_request.yml").read()))
            obj.execution = obj.engine.config['execution'][0]
            obj.settings.merge({
                "path": os.path.join(os.path.dirname(__file__), '..', "phantom.sh"),
            })
            obj.prepare()
            with open(obj.pbench.schedule_file) as fds:
                config = fds.readlines()

            get_requests = [req_str.split(" ")[1] for req_str in config if req_str.startswith("GET")]
            self.assertEqual(len(get_requests), 2)

            for get_req in get_requests:
                self.assertEqual(dict(parse.parse_qsl(parse.urlsplit(get_req).query)),
                                 {"get_param1": "value1", "get_param2": "value2"})
开发者ID:SanjeebJena,项目名称:taurus,代码行数:22,代码来源:test_pbench.py


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