[Asterisk-code-review] Fix coordinated transfer failures (testsuite[master])
Mark Michelson
asteriskteam at digium.com
Thu Feb 11 15:07:19 CST 2016
Mark Michelson has uploaded a new change for review.
https://gerrit.asterisk.org/2241
Change subject: Fix coordinated transfer failures
......................................................................
Fix coordinated transfer failures
Scenarios that use SIPp's third party call control contain a coordinated
receiver scenario. This scenario opens a TCP port over which other
scenarios can send commands. Sometimes these tests will fail because the
coordinated scenario will not have its TCP port open by the time that
other scenarios are attempting to send commands.
This commit introduces a 'delay' option for SIPp scenarios that allows
for the SIPp scenario's start to be delayed by the number of seconds
specified. Each transfer scenario that uses a coordinated receiver now
has all other scenarios delayed by two seconds to allow for the
coordinated receiver to open its TCP port.
Change-Id: I0d5e1a7c352e7801ffdbf05ed06fd962a796c372
---
M lib/python/asterisk/sipp.py
M tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local/test-config.yaml
M tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_blonde/test-config.yaml
M tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local/test-config.yaml
M tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/test-config.yaml
5 files changed, 31 insertions(+), 20 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/41/2241/2
diff --git a/lib/python/asterisk/sipp.py b/lib/python/asterisk/sipp.py
index 83f5e82..e7e2f5e 100644
--- a/lib/python/asterisk/sipp.py
+++ b/lib/python/asterisk/sipp.py
@@ -560,6 +560,7 @@
self.target = target
self._our_exit_deferred = None
self._test_case = None
+ self.delay = scenario.get('delay')
if not self.sipp:
raise ValueError("SIPpTestObject requires that sipp is installed")
@@ -609,6 +610,16 @@
self._test_case.stop_reactor()
return result
+ def __spawn_process():
+ LOGGER.info("Executing SIPp scenario: %s" % self.name)
+ LOGGER.debug(sipp_args)
+ reactor.spawnProcess(self._process,
+ sipp_args[0],
+ sipp_args,
+ {"TERM": "vt100", },
+ None,
+ None)
+
self.result = None
sipp_args = [
self.sipp, self.target,
@@ -628,6 +639,8 @@
# Override and extend defaults
default_args.update(self.scenario)
del default_args['scenario']
+ if self.delay:
+ del default_args['delay']
# correct the path specified by -slave_cfg
if '-slave_cfg' in default_args:
@@ -642,9 +655,6 @@
sipp_args.extend([key, val])
sipp_args.extend(self.positional_args)
- LOGGER.info("Executing SIPp scenario: %s" % self.scenario['scenario'])
- LOGGER.debug(sipp_args)
-
self._our_exit_deferred = defer.Deferred()
exit_deferred = defer.Deferred()
@@ -655,12 +665,13 @@
self._process = SIPpProtocol(self.scenario['scenario'], exit_deferred,
start_deferred)
- reactor.spawnProcess(self._process,
- sipp_args[0],
- sipp_args,
- {"TERM": "vt100", },
- None,
- None)
+ if self.delay:
+ LOGGER.info("Delaying execution of {0} by {1} "
+ "seconds".format(self.name, self.delay))
+ reactor.callLater(self.delay, __spawn_process)
+ else:
+ __spawn_process()
+
return self._our_exit_deferred
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local/test-config.yaml b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local/test-config.yaml
index e296325..500297c 100644
--- a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local/test-config.yaml
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local/test-config.yaml
@@ -25,10 +25,10 @@
test-iterations:
-
scenarios:
- - { 'coordinated-sender': {'key-args': {'scenario':'referer_uas.xml', '-p':'5066'} },
+ - { 'coordinated-sender': {'key-args': {'delay': 2, 'scenario':'referer_uas.xml', '-p':'5066'} },
'coordinated-receiver': { 'key-args': {'scenario':'referee.xml', '-p':'5065'} } }
- - { 'key-args': {'scenario':'uas.xml', '-p':'5067'} }
- - { 'key-args': {'scenario':'uac-no-hangup.xml', '-p':'5068', '-s':'alice'} }
+ - { 'key-args': {'delay': 2, 'scenario':'uas.xml', '-p':'5067'} }
+ - { 'key-args': {'delay': 2, 'scenario':'uac-no-hangup.xml', '-p':'5068', '-s':'alice'} }
ami-config:
-
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_blonde/test-config.yaml b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_blonde/test-config.yaml
index 3154c80..88ca4ca 100644
--- a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_blonde/test-config.yaml
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_blonde/test-config.yaml
@@ -31,10 +31,10 @@
test-iterations:
-
scenarios:
- - { 'coordinated-sender': {'key-args': {'scenario':'referer_uas.xml', '-p':'5066'} },
+ - { 'coordinated-sender': {'key-args': {'delay': 2, 'scenario':'referer_uas.xml', '-p':'5066'} },
'coordinated-receiver': { 'key-args': {'scenario':'referee.xml', '-p':'5065'} } }
- - { 'key-args': {'scenario':'uas.xml', '-p':'5067'} }
- - { 'key-args': {'scenario':'uac-no-hangup.xml', '-p':'5068', '-s':'alice'} }
+ - { 'key-args': {'delay': 2, 'scenario':'uas.xml', '-p':'5067'} }
+ - { 'key-args': {'delay': 2, 'scenario':'uac-no-hangup.xml', '-p':'5068', '-s':'alice'} }
ami-config:
-
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local/test-config.yaml b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local/test-config.yaml
index 4bf00e1..517ee57 100644
--- a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local/test-config.yaml
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local/test-config.yaml
@@ -30,7 +30,7 @@
-
scenarios:
- { 'key-args': {'scenario':'uas.xml', '-p':'5067', '-m':'2'} }
- - { 'coordinated-sender': {'key-args': {'scenario':'referer.xml', '-p':'5066'} },
+ - { 'coordinated-sender': {'key-args': {'delay': 2, 'scenario':'referer.xml', '-p':'5066'} },
'coordinated-receiver': {'key-args': {'scenario':'referee.xml', '-p':'5065'} } }
ami-config:
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/test-config.yaml b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/test-config.yaml
index 4096f96..dc69fe0 100644
--- a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/test-config.yaml
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/test-config.yaml
@@ -34,10 +34,10 @@
test-iterations:
-
scenarios:
- - { 'key-args': {'scenario':'uas.xml', '-p':'5067', '-m':'2'} }
- - { 'key-args': {'scenario':'uas_hangup.xml', '-p':'5068', '-m':'2'} }
- - { 'coordinated-sender': {'key-args': {'scenario':'referer.xml', '-p':'5066'} },
- 'coordinated-receiver': {'key-args': {'scenario':'referee.xml', '-p':'5065'} } }
+ - { 'key-args': {'delay': 2, 'scenario':'uas.xml', '-p':'5067', '-m':'2'} }
+ - { 'key-args': {'delay': 2, 'scenario':'uas_hangup.xml', '-p':'5068', '-m':'2'} }
+ - { 'coordinated-sender': {'key-args': {'delay': 2, 'scenario':'referer.xml', '-p':'5066'} },
+ 'coordinated-receiver': {'key-args': {'delay': 2, 'scenario':'referee.xml', '-p':'5065'} } }
ami-config:
-
--
To view, visit https://gerrit.asterisk.org/2241
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d5e1a7c352e7801ffdbf05ed06fd962a796c372
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
More information about the asterisk-code-review
mailing list