[svn-commits] coreyfarrell: testsuite/asterisk/trunk r6515 - in /asterisk/trunk/tests/rest_...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 11 15:12:57 CDT 2015


Author: coreyfarrell
Date: Wed Mar 11 15:12:53 2015
New Revision: 6515

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=6515
Log:
Delete bridges on completion for a bunch of rest_api tests.

ARI users are responsible for deleting bridges when they are no longer
needed.  This change deletes bridges at the appropriate time, allowing
these tests to pass with REF_DEBUG enabled.

Review: https://reviewboard.asterisk.org/r/4170/

Modified:
    asterisk/trunk/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py
    asterisk/trunk/tests/rest_api/bridges/add_recording_channel/add_recording_channel.py
    asterisk/trunk/tests/rest_api/bridges/hangup/bridge_hangup.py
    asterisk/trunk/tests/rest_api/bridges/hangup/test-config.yaml
    asterisk/trunk/tests/rest_api/bridges/happy/bridge_happy.py
    asterisk/trunk/tests/rest_api/bridges/happy/test-config.yaml
    asterisk/trunk/tests/rest_api/bridges/move/bridge_move.py
    asterisk/trunk/tests/rest_api/bridges/unhappy/bridge_unhappy.py
    asterisk/trunk/tests/rest_api/channels/snoop_spy/channel_spy.py
    asterisk/trunk/tests/rest_api/channels/snoop_spy/test-config.yaml

Modified: asterisk/trunk/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py?view=diff&rev=6515&r1=6514&r2=6515
==============================================================================
--- asterisk/trunk/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py (original)
+++ asterisk/trunk/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py Wed Mar 11 15:12:53 2015
@@ -52,5 +52,6 @@
     # bridge-watching-app received a ChannelLeftBridge event
     assert TEST.bridge_id == event['bridge']['id']
     assert TEST.channel_id == event['channel']['id']
-    ari.delete('channels', TEST.channel_id);
+    ari.delete('channels', TEST.channel_id)
+    ari.delete('bridges', TEST.bridge_id)
     return True

Modified: asterisk/trunk/tests/rest_api/bridges/add_recording_channel/add_recording_channel.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/add_recording_channel/add_recording_channel.py?view=diff&rev=6515&r1=6514&r2=6515
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/add_recording_channel/add_recording_channel.py (original)
+++ asterisk/trunk/tests/rest_api/bridges/add_recording_channel/add_recording_channel.py Wed Mar 11 15:12:53 2015
@@ -25,5 +25,6 @@
         # done so stop recording and remove
         ari.delete('recordings/live', 'test_adding_recording')
         ari.delete('channels', channel_id)
+        ari.delete('bridges', bridge_id)
 
     return True

Modified: asterisk/trunk/tests/rest_api/bridges/hangup/bridge_hangup.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/hangup/bridge_hangup.py?view=diff&rev=6515&r1=6514&r2=6515
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/hangup/bridge_hangup.py (original)
+++ asterisk/trunk/tests/rest_api/bridges/hangup/bridge_hangup.py Wed Mar 11 15:12:53 2015
@@ -29,6 +29,12 @@
     return True
 
 
+def on_stop(ari, event, test_object):
+    LOGGER.debug("on_stop(%r)" %event)
+    ari.delete('bridges', TEST.bridge_id)
+    return True
+
+
 def on_enter(ari, event, test_object):
     channel_id = event['channel']['id']
     bridge_id = event['bridge']['id']

Modified: asterisk/trunk/tests/rest_api/bridges/hangup/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/hangup/test-config.yaml?view=diff&rev=6515&r1=6514&r2=6515
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/hangup/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/bridges/hangup/test-config.yaml Wed Mar 11 15:12:53 2015
@@ -52,6 +52,14 @@
                     type: ChannelLeftBridge
                     application: testsuite
             count: 1
+        -   conditions:
+                match:
+                    type: StasisEnd
+                    application: testsuite
+            count: 1
+            callback:
+                module: bridge_hangup
+                method: on_stop
 
 properties:
     minversion: '12.0.0'

Modified: asterisk/trunk/tests/rest_api/bridges/happy/bridge_happy.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/happy/bridge_happy.py?view=diff&rev=6515&r1=6514&r2=6515
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/happy/bridge_happy.py (original)
+++ asterisk/trunk/tests/rest_api/bridges/happy/bridge_happy.py Wed Mar 11 15:12:53 2015
@@ -29,6 +29,12 @@
     return True
 
 
+def on_stop(ari, event, test_object):
+    LOGGER.debug("on_stop(%r)" %event)
+    ari.delete('bridges', TEST.bridge_id)
+    return True
+
+
 def on_enter(ari, event, test_object):
     channel_id = event['channel']['id']
     bridge_id = event['bridge']['id']

Modified: asterisk/trunk/tests/rest_api/bridges/happy/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/happy/test-config.yaml?view=diff&rev=6515&r1=6514&r2=6515
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/happy/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/bridges/happy/test-config.yaml Wed Mar 11 15:12:53 2015
@@ -56,6 +56,14 @@
             callback:
                 module: bridge_happy
                 method: on_leave
+        -   conditions:
+                match:
+                    type: StasisEnd
+                    application: testsuite
+            count: 1
+            callback:
+                module: bridge_happy
+                method: on_stop
 
 properties:
     minversion: '12.0.0'

Modified: asterisk/trunk/tests/rest_api/bridges/move/bridge_move.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/move/bridge_move.py?view=diff&rev=6515&r1=6514&r2=6515
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/move/bridge_move.py (original)
+++ asterisk/trunk/tests/rest_api/bridges/move/bridge_move.py Wed Mar 11 15:12:53 2015
@@ -56,5 +56,7 @@
 
 
 def on_end(ari, event, test_object):
+    ari.delete('bridges', TEST.bridge1_id)
+    ari.delete('bridges', TEST.bridge2_id)
     test_object.stop_reactor()
     return True

Modified: asterisk/trunk/tests/rest_api/bridges/unhappy/bridge_unhappy.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/unhappy/bridge_unhappy.py?view=diff&rev=6515&r1=6514&r2=6515
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/unhappy/bridge_unhappy.py (original)
+++ asterisk/trunk/tests/rest_api/bridges/unhappy/bridge_unhappy.py Wed Mar 11 15:12:53 2015
@@ -151,6 +151,8 @@
         resp = ari.post('bridges', bridge_id, 'removeChannel',
                         channel=self.stasis_channel_id)
         resp.raise_for_status()
+        ari.delete('bridges', bridge_id);
+        ari.delete('bridges', other_bridge_id);
 
 
 TEST = BridgeUnhappy()

Modified: asterisk/trunk/tests/rest_api/channels/snoop_spy/channel_spy.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/snoop_spy/channel_spy.py?view=diff&rev=6515&r1=6514&r2=6515
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/snoop_spy/channel_spy.py (original)
+++ asterisk/trunk/tests/rest_api/channels/snoop_spy/channel_spy.py Wed Mar 11 15:12:53 2015
@@ -13,6 +13,7 @@
 class Snoop(object):
     def __init__(self):
         self.bridge_id = None
+        self.stops = 0
 
 TEST = Snoop()
 
@@ -33,3 +34,10 @@
     LOGGER.debug("on_amd_start(%r)" % event)
     ari.post('bridges', TEST.bridge_id, 'addChannel', channel=event['channel']['id'])
     return True
+
+def on_end(ari, event, test_object):
+    LOGGER.debug("on_end(%r)" % event)
+    TEST.stops += 1
+    if TEST.stops == 3:
+        ari.delete('bridges', TEST.bridge_id)
+    return True

Modified: asterisk/trunk/tests/rest_api/channels/snoop_spy/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/snoop_spy/test-config.yaml?view=diff&rev=6515&r1=6514&r2=6515
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/snoop_spy/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/channels/snoop_spy/test-config.yaml Wed Mar 11 15:12:53 2015
@@ -78,6 +78,14 @@
             callback:
                 module: channel_spy
                 method: on_amd_start
+        -   conditions:
+                match:
+                    type: StasisEnd
+                    application: testsuite
+            count: 3
+            callback:
+                module: channel_spy
+                method: on_end
 
 properties:
     minversion: '12.0.0'




More information about the svn-commits mailing list