[asterisk-commits] mjordan: testsuite/asterisk/trunk r5846 - in /asterisk/trunk: lib/python/aste...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Nov 1 18:17:21 CDT 2014


Author: mjordan
Date: Sat Nov  1 18:17:15 2014
New Revision: 5846

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5846
Log:
tests/rest_api/channels/originate_with_id: Fix stability problems

This test also had problems with the WebSocket being closed when the test
stops. A new pluggable module that uses the action/event framework has been
added that lets an event trigger a test stop. The lets the last expected
event received trigger the test stop.

Modified:
    asterisk/trunk/lib/python/asterisk/pluggable_modules.py
    asterisk/trunk/tests/rest_api/channels/originate_with_id/test-config.yaml

Modified: asterisk/trunk/lib/python/asterisk/pluggable_modules.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/pluggable_modules.py?view=diff&rev=5846&r1=5845&r2=5846
==============================================================================
--- asterisk/trunk/lib/python/asterisk/pluggable_modules.py (original)
+++ asterisk/trunk/lib/python/asterisk/pluggable_modules.py Sat Nov  1 18:17:15 2014
@@ -814,3 +814,26 @@
         self.test_object.set_passed(method(self.test_object, triggered_by,
                                            source, extra))
 PLUGGABLE_ACTION_REGISTRY.register("callback", CallbackActionModule)
+
+class StopTestActionModule(object):
+    """Action module that stops a test"""
+
+    def __init__(self, test_object, config):
+        """Constructor
+
+        Keyword Arguments:
+        test_object The main test object
+        config      The pluggable module config
+        """
+        self.test_object = test_object
+
+    def run(self, triggered_by, source, extra):
+        """Execute the action, which stops the test
+
+        Keyword Arguments:
+        triggered_by The event that triggered this action
+        source       The Asterisk interface object that provided the event
+        extra        Source dependent data
+        """
+        self.test_object.stop_reactor()
+PLUGGABLE_ACTION_REGISTRY.register("stop_test", StopTestActionModule)

Modified: asterisk/trunk/tests/rest_api/channels/originate_with_id/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/originate_with_id/test-config.yaml?view=diff&rev=5846&r1=5845&r2=5846
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/originate_with_id/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/channels/originate_with_id/test-config.yaml Sat Nov  1 18:17:15 2014
@@ -27,7 +27,8 @@
         config-section: test-object-config
         typename: ari.AriOriginateTestObject
     modules:
-        -   config-section: ari-config
+        -
+            config-section: ari-config
             typename: ari.WebSocketEventModule
         -
             config-section: ami-config
@@ -35,8 +36,12 @@
         -
             config-section: cel-config
             typename: 'ami.AMIEventModule'
+        -
+            config-section: ari-test-stopper
+            typename: pluggable_modules.EventActionModule
 
 test-object-config:
+    stop-on-end: False
     test-iterations:
         -
             # test 1 - both id's creating local channel
@@ -59,6 +64,16 @@
             channelId: 'MyStasisId'
             otherChannelId: 'MyOtherStasisId'
             app: 'testsuite'
+
+ari-test-stopper:
+    -
+        ari-events:
+            match:
+                type: ChannelDestroyed
+                application: testsuite
+                channel:
+                    id: 'MyStasisId$'
+        stop_test:
 
 ari-config:
     apps: testsuite
@@ -105,14 +120,6 @@
         -
             conditions:
                 match:
-                    type: ChannelDestroyed
-                    application: testsuite
-                    channel:
-                        id: 'MyStasisId$'
-            count: 1
-        -
-            conditions:
-                match:
                     type: StasisEnd
                     application: testsuite
                     channel:




More information about the asterisk-commits mailing list