[svn-commits] mjordan: testsuite/asterisk/trunk r5061 - /asterisk/trunk/tests/rest_api/brid...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat May 24 12:34:36 CDT 2014


Author: mjordan
Date: Sat May 24 12:34:22 2014
New Revision: 5061

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5061
Log:
rest_api/bridges/attended_transfer: Try to start referer scenario second

When using 3pcc, the first scenario that uses sendCmd will establish a TCP
socket connection with the scenario that uses recvCmd first. As such, the
sendCmd scenario *must* start after the recvCmd scenario. The test was,
unfortunately, starting both at the same time. This was highly unlikely to
work reliably.

Unfortunately, knowing when a process has started is a bit tricky. Our SIPp
classes return a deferred that is executed when the process exits; that's not
super useful here. The spawnProcess twisted command returns the IProtocol
instance, which _might_ work, but also doesn't give you easy access to the
state of the process. (You can control the process, but it's not exactly
event driven as to when the process has kicked off). What's more, exposing
the IProtocol instance through our SIPp wrapper would be a bit disruptive.

To work around that, this patch kicks off the referer scenario (which uses
sendCmd first) a few seconds after it kicks off the referee scenario. If
this doesn't prove to be 'good enough', we'll have to find a more
deterministic way to know when the first process is running and the TCP
socket listening.

Modified:
    asterisk/trunk/tests/rest_api/bridges/attended_transfer/attended_transfer.py

Modified: asterisk/trunk/tests/rest_api/bridges/attended_transfer/attended_transfer.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/attended_transfer/attended_transfer.py?view=diff&rev=5061&r1=5060&r2=5061
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/attended_transfer/attended_transfer.py (original)
+++ asterisk/trunk/tests/rest_api/bridges/attended_transfer/attended_transfer.py Sat May 24 12:34:22 2014
@@ -24,12 +24,22 @@
 def on_kickoff_start(ari, event, test_object):
     LOGGER.debug("on_kickoff_start(%r)" % event)
 
+    def _start_referer_scenario(referer_scenario, test_object):
+        referer_scenario.run(test_object)
+
     sipp_referer = SIPpScenario(test_object.test_name,
         {'scenario':'referer.xml', '-p':'5065', '-3pcc':'127.0.0.1:5064'}, target='127.0.0.1')
     sipp_referee = SIPpScenario(test_object.test_name,
         {'scenario':'referee.xml', '-p':'5066', '-3pcc':'127.0.0.1:5064'}, target='127.0.0.1')
-    sipp_referer.run(test_object)
+
     sipp_referee.run(test_object)
+
+    # The 3pcc scenario that first uses sendCmd (sipp_referer) will establish
+    # a TCP socket with the other scenario (sipp_referee). This _must_ start
+    # after sipp_referee - give it a few seconds to get the process off the
+    # ground.
+    from twisted.internet import reactor
+    reactor.callLater(3, _start_referer_scenario, sipp_referer, test_object)
 
     TEST.bridge_id = ari.post('bridges').json()['id']
     TEST.originated_id = event['channel']['id']




More information about the svn-commits mailing list