Refine semantics of replay_request method.

This commit is contained in:
Aldo Cortesi 2012-07-10 23:29:33 +12:00
parent 04d9ec8c3c
commit 01b8b0d876
2 changed files with 6 additions and 8 deletions

View File

@ -1361,7 +1361,7 @@ class FlowMaster(controller.Master):
if self.stickycookie_state:
self.stickycookie_state.handle_response(f)
def replay_request(self, f):
def replay_request(self, f, block=False):
"""
Returns None if successful, or error message if not.
"""
@ -1382,7 +1382,8 @@ class FlowMaster(controller.Master):
self.masterq,
)
rt.start() # pragma: no cover
return rt
if block:
rt.join()
def run_script_hook(self, name, *args, **kwargs):
if self.script and not self.pause_scripts:

View File

@ -26,20 +26,17 @@ class SanityMixin:
l = self.master.state.view[0]
assert l.response.code == 304
l.request.path = "/p/305"
rt = self.master.replay_request(l)
rt.join()
rt = self.master.replay_request(l, block=True)
assert l.response.code == 305
# Disconnect error
l.request.path = "/p/305:d0"
rt = self.master.replay_request(l)
rt.join()
rt = self.master.replay_request(l, block=True)
assert l.error
# Port error
l.request.port = 1
rt = self.master.replay_request(l)
rt.join()
rt = self.master.replay_request(l, block=True)
assert l.error