mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 15:37:35 +08:00
fix #455: response time ascends while locusts running, with concurrency unchanged
This commit is contained in:
@@ -123,12 +123,12 @@ class Runner(object):
|
|||||||
""" call hook actions.
|
""" call hook actions.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
actions (str/dict): actions maybe in two format.
|
actions (list): each action in actions list maybe in two format.
|
||||||
|
|
||||||
format1: only call hook functions.
|
format1 (dict): assignment, the value returned by hook function will be assigned to variable.
|
||||||
${func()}
|
|
||||||
format2: assignment, the value returned by hook function will be assigned to variable.
|
|
||||||
{"var": "${func()}"}
|
{"var": "${func()}"}
|
||||||
|
format2 (str): only call hook functions.
|
||||||
|
${func()}
|
||||||
|
|
||||||
hook_type (enum): setup/teardown
|
hook_type (enum): setup/teardown
|
||||||
|
|
||||||
@@ -137,6 +137,7 @@ class Runner(object):
|
|||||||
for action in actions:
|
for action in actions:
|
||||||
|
|
||||||
if isinstance(action, dict) and len(action) == 1:
|
if isinstance(action, dict) and len(action) == 1:
|
||||||
|
# format 1
|
||||||
# {"var": "${func()}"}
|
# {"var": "${func()}"}
|
||||||
var_name, hook_content = list(action.items())[0]
|
var_name, hook_content = list(action.items())[0]
|
||||||
logger.log_debug("assignment with hook: {} = {}".format(var_name, hook_content))
|
logger.log_debug("assignment with hook: {} = {}".format(var_name, hook_content))
|
||||||
@@ -145,6 +146,7 @@ class Runner(object):
|
|||||||
self.session_context.eval_content(hook_content)
|
self.session_context.eval_content(hook_content)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
# format 2
|
||||||
logger.log_debug("call hook function: {}".format(action))
|
logger.log_debug("call hook function: {}".format(action))
|
||||||
# TODO: check hook function if valid
|
# TODO: check hook function if valid
|
||||||
self.session_context.eval_content(action)
|
self.session_context.eval_content(action)
|
||||||
@@ -201,8 +203,8 @@ class Runner(object):
|
|||||||
self.session_context.update_test_variables("request", parsed_test_request)
|
self.session_context.update_test_variables("request", parsed_test_request)
|
||||||
|
|
||||||
# setup hooks
|
# setup hooks
|
||||||
setup_hooks = test_dict.get("setup_hooks", [])
|
setup_hooks = ["${setup_hook_prepare_kwargs($request)}"]
|
||||||
setup_hooks.insert(0, "${setup_hook_prepare_kwargs($request)}")
|
setup_hooks.extend(test_dict.get("setup_hooks", []))
|
||||||
self.do_hook_actions(setup_hooks, "setup")
|
self.do_hook_actions(setup_hooks, "setup")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user