def test_full_execution(self): obj = ApacheBenchmarkExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME),}) obj.execution.merge({ "concurrency": 2, "iterations": 3, "headers": { "Content-Type": "text/plain" }, "scenario": { "keepalive": True, "requests": [ { "url": "http://blazedemo.com", "headers": [ {"X-Answer": "42"}, ], "keepalive": False, "method": "GET", } ], } }) obj.prepare() try: obj.startup() while not obj.check(): time.sleep(obj.engine.check_interval) finally: obj.shutdown() obj.post_process() self.assertNotEquals(obj.process, None)
def test_full_execution(self): obj = ApacheBenchmarkExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME),}) obj.execution.merge({ "concurrency": 2, "iterations": 3, "headers": { "Content-Type": "text/plain" }, "scenario": { "keepalive": True, "requests": [ { "url": "http://blazedemo.com", "headers": [ {"X-Answer": "42"}, ], "keepalive": False, "method": "GET", } ], } }) obj.prepare() obj.get_widget() try: obj.startup() while not obj.check(): time.sleep(obj.engine.check_interval) finally: obj.shutdown() obj.post_process() self.assertNotEquals(obj.process, None)
def test_iter(self): "Ensures that executor doesn't fail with minimal configuration." obj = ApacheBenchmarkExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME),}) obj.execution.merge({ "scenario": { "requests": ["http://blazedemo.com"] } }) obj.prepare() try: obj.startup() while not obj.check(): time.sleep(obj.engine.check_interval) finally: obj.shutdown() obj.post_process() self.assertNotEquals(obj.process, None)
def test_diagnostics(self): obj = ApacheBenchmarkExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME), }) obj.execution.merge({ "concurrency": 1, "iterations": 1, "scenario": { "requests": ["http://blazedemo.com"] } }) obj.prepare() obj.startup() while not obj.check(): time.sleep(obj.engine.check_interval) obj.shutdown() obj.post_process() self.assertIsNotNone(obj.get_error_diagnostics())
def test_iter(self): "Ensures that executor doesn't fail with minimal configuration." obj = ApacheBenchmarkExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME), }) obj.execution.merge( {"scenario": { "requests": ["http://blazedemo.com"] }}) obj.prepare() try: obj.startup() while not obj.check(): time.sleep(obj.engine.check_interval) finally: obj.shutdown() obj.post_process() self.assertNotEquals(obj.process, None)