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