[Asterisk-code-review] asterisk/sipp: Add option to SIPpScenarioSequence to control... (testsuite[master])
Matt Jordan
asteriskteam at digium.com
Thu Oct 22 08:16:22 CDT 2015
Matt Jordan has uploaded a new change for review.
https://gerrit.asterisk.org/1482
Change subject: asterisk/sipp: Add option to SIPpScenarioSequence to control stopping reactor
......................................................................
asterisk/sipp: Add option to SIPpScenarioSequence to control stopping reactor
By default, SIPpScenarioSequence will stop the TestCase object reactor when the
final SIPp scenario in the sequence has finished. In some cases, however,
particularly when the SIPp scenarios are being used to drive a more complex set
of tests, this isn't desireable. Instead, the test is stopped based on more
complex criteria outside of the SIPp scenario's knowledge.
This patch adds a new option to the SIPpScenarioSequence constructor that
informs it to stop the reactor when all scenarios have executed. By default,
this option is set to True for backwards compatibility reasons.
Change-Id: I4811f25ec1a9c77bbd122de43e4e228d7f5a9c2a
---
M lib/python/asterisk/sipp.py
1 file changed, 7 insertions(+), 2 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/82/1482/1
diff --git a/lib/python/asterisk/sipp.py b/lib/python/asterisk/sipp.py
index 0574ccd..83f5e82 100644
--- a/lib/python/asterisk/sipp.py
+++ b/lib/python/asterisk/sipp.py
@@ -318,7 +318,8 @@
def __init__(self, test_case, sipp_scenarios=None,
fail_on_any=False,
intermediate_cb_fn=None,
- final_deferred=None):
+ final_deferred=None,
+ stop_on_done=True):
"""Create a new sequence of scenarios
Keyword Arguments:
@@ -339,6 +340,8 @@
have executed, but before the reactor is stopped.
The parameter passed to the deferred callback
function will be this object.
+ stop_on_done Stop the test_case object when all scenarios have
+ executed. Defaults to True.
"""
self._sipp_scenarios = sipp_scenarios or []
self._test_case = test_case
@@ -348,6 +351,7 @@
self._final_deferred = final_deferred
self._scenario_start_fn = None
self._scenario_stop_fn = None
+ self._stop_on_done = stop_on_done
def register_scenario_start_callback(self, callback_fn):
"""Register a callback function that will be called on the start of
@@ -397,7 +401,8 @@
else:
if self._final_deferred:
self._final_deferred.callback(self)
- self._test_case.stop_reactor()
+ if self._stop_on_done:
+ self._test_case.stop_reactor()
return result
scenarios = self._sipp_scenarios[self._test_counter]
--
To view, visit https://gerrit.asterisk.org/1482
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4811f25ec1a9c77bbd122de43e4e228d7f5a9c2a
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
More information about the asterisk-code-review
mailing list