def test_hold(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME), }) obj.execution.merge({ "concurrency": 2, "hold-for": '2s', "scenario": { "headers": { 'h1': 'value1', 'h2': 'value2' }, "variables": { 'v1': 1, 'v2': 'TWO' }, "script": get_res_path('url-file') } }) obj.prepare() obj.prepare() self.assertNotEqual(len(obj.resource_files()), 0) obj.get_widget() obj.startup()
def test_url_exceptions(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME),}) obj.execution.merge({ "concurrency": 2, "hold-for": '2s', "scenario": {}}) self.assertRaises(TaurusConfigError, obj.prepare)
def test_check_install_exceptions(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": '*',}) obj.execution.merge({ "concurrency": 2, "hold-for": '2s', "scenario": {}}) self.assertRaises(RuntimeError, obj.prepare)
def test_check_install_exceptions(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": '*',}) obj.execution.merge({ "concurrency": 2, "hold-for": '2s', "scenario": {}}) self.assertRaises(ToolError, obj.prepare)
def test_url_exceptions(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME),}) obj.execution.merge({ "concurrency": 2, "hold-for": '2s', "scenario": {}}) self.assertRaises(ValueError, obj.prepare)
def test_repetition_exceptions(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME),}) obj.execution.merge({ "concurrency": 2, "scenario": { "requests": ["http://blazedemo.com", "http://ya.ru"]}}) obj.prepare() self.assertEqual(len(obj.resource_files()), 0) self.assertRaises(TaurusConfigError, obj.startup)
def test_repetition_exceptions(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME),}) obj.execution.merge({ "concurrency": 2, "scenario": { "requests": ["http://blazedemo.com", "http://ya.ru"]}}) obj.prepare() self.assertEqual(len(obj.resource_files()), 0) self.assertRaises(ValueError, obj.startup)
def test_check_install_exceptions(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": '*',}) obj.execution.merge({ "concurrency": 2, "hold-for": '2s', "scenario": {}}) try: obj.prepare() except RuntimeError: return self.fail()
def test_url_exceptions(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME),}) obj.execution.merge({ "concurrency": 2, "hold-for": '2s', "scenario": {}}) try: obj.prepare() except ValueError: return self.fail()
def test_repetition_exceptions(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME),}) obj.execution.merge({ "concurrency": 2, "scenario": { "requests": ["http://blazedemo.com", "http://ya.ru"]}}) obj.prepare() try: obj.startup() except ValueError: return self.fail()
def test_iter(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME),}) obj.execution.merge({ "concurrency": 2, "iterations": 3, "scenario": { "think-time": "1s", "requests": ["http://blazedemo.com", "http://ya.ru"]} }) obj.prepare() obj.get_widget() obj.startup()
def test_check_install_exceptions(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": '*', }) obj.execution.merge({ "concurrency": 2, "hold-for": '2s', "scenario": {} }) try: obj.prepare() except RuntimeError: return self.fail()
def test_url_exceptions(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME), }) obj.execution.merge({ "concurrency": 2, "hold-for": '2s', "scenario": {} }) try: obj.prepare() except ValueError: return self.fail()
def test_repetition_exceptions(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME), }) obj.execution.merge({ "concurrency": 2, "scenario": { "requests": ["http://blazedemo.com", "http://ya.ru"] } }) obj.prepare() try: obj.startup() except ValueError: return self.fail()
def test_hold(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME),}) obj.execution.merge({ "concurrency": 2, "hold-for": '2s', "scenario": { "headers": { 'h1': 'value1', 'h2': 'value2'}, "variables": { 'v1': 1, 'v2': 'TWO'}, "script": get_res_path('url-file')}}) obj.prepare() obj.get_widget() obj.startup()
def test_diagnostics(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME), }) obj.execution.merge({ "iterations": 1, "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.assertIsNotNone(obj.get_error_diagnostics())
def test_full_execution(self): obj = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME),}) obj.execution.merge({ "concurrency": 2, "iterations": 3, "scenario": { "requests": ["http://blazedemo.com", "http://ya.ru"]} }) obj.prepare() obj.startup() try: 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 = SiegeExecutor() obj.engine = EngineEmul() obj.settings.merge({ "path": get_res_path(TOOL_NAME),}) obj.execution.merge({ "concurrency": 2, "iterations": 3, "scenario": { "requests": ["http://blazedemo.com", "http://ya.ru"]} }) 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)