[asterisk-commits] mjordan: testsuite/asterisk/trunk r4846 - /asterisk/trunk/tests/rest_api/chan...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 14 16:11:28 CDT 2014


Author: mjordan
Date: Fri Mar 14 16:11:24 2014
New Revision: 4846

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4846
Log:
rest_api/channels/originate: Check for hangups and end test accordingly

The rest_api/channels/originate test had no check for when it was done. The
reactor would eventually time out, and the test would fail since no one had
told it to succeed. We now look for the appropriate number of channel
destroyed events and - if we get them all - pass the test.

Modified:
    asterisk/trunk/tests/rest_api/channels/originate/channel_originate.py
    asterisk/trunk/tests/rest_api/channels/originate/test-config.yaml

Modified: asterisk/trunk/tests/rest_api/channels/originate/channel_originate.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/originate/channel_originate.py?view=diff&rev=4846&r1=4845&r2=4846
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/originate/channel_originate.py (original)
+++ asterisk/trunk/tests/rest_api/channels/originate/channel_originate.py Fri Mar 14 16:11:24 2014
@@ -10,6 +10,8 @@
 
 LOGGER = logging.getLogger(__name__)
 
+CHANNELS = 0
+
 def on_kickoff_start(ari, event, test_object):
     LOGGER.debug("on_kickoff_start(%r)" % event)
     for x in xrange(25):
@@ -20,3 +22,13 @@
 def on_blast_start(ari, event, test_object):
     LOGGER.debug("on_blast_start(%r)" % event)
     return True
+
+def on_channel_destroyed(ari, event, test_object):
+	global CHANNELS
+	LOGGER.debug("on_channel_destroyed: %s" % str(event.get('channel')))
+	CHANNELS += 1
+	if CHANNELS == 25:
+		LOGGER.info("All channels destroyed")
+		test_object.set_passed(True)
+		test_object.stop_reactor()
+	return True

Modified: asterisk/trunk/tests/rest_api/channels/originate/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/originate/test-config.yaml?view=diff&rev=4846&r1=4845&r2=4846
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/originate/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/channels/originate/test-config.yaml Fri Mar 14 16:11:24 2014
@@ -33,6 +33,14 @@
             callback:
                 module: channel_originate
                 method: on_blast_start
+        -   conditions:
+                match:
+                    type: ChannelDestroyed
+                    application: testsuite
+            count: 25
+            callback:
+                module: channel_originate
+                method: on_channel_destroyed
 
 properties:
     minversion: '12.0.0'




More information about the asterisk-commits mailing list