本文整理汇总了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)
示例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()
示例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")
示例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
示例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()
示例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()
示例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"})