[asterisk-commits] mjordan: testsuite/asterisk/trunk r4904 - /asterisk/trunk/tests/rest_api/appl...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 27 23:02:43 CDT 2014


Author: mjordan
Date: Thu Mar 27 23:02:35 2014
New Revision: 4904

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4904
Log:
rest_api/applications/subscribe-bridge: Fix failing test

The change in r410528 (https://reviewboard.asterisk.org/r/3336/) for
ASTERISK-23295 introduced a subtle behaviour change that broke the
rest_api/bridges/subscription test. Previously, the test did the following:

* Create a Stasis application 'testsuite'
* Create a Stasis application 'bridge-watching-app'
* POST a channel to application 'testsuite'
* POST a bridge
* Subscribe application 'bridge-watching-app' to the bridge
* Add the previously posted channel to the bridge
** Verify that the app 'testsuite' sees the bridge update (as its channel is
   in the bridge)
** Verify that the app 'bridge-watching-app' sees the bridge update (as it
   was subscribed)
* Unsubscribe the app 'testsuite' from the bridge
* Remove the channel from the bridge
** Verify that the app 'bridge-watching-app' see the bridge update
** Verify that the app 'testsuite' does NOT see the bridge update
   <--- THIS LAST STEP IS BROKEN --->

The last verification broke because we now ensure that applications who have
channels in a bridge are now subscribed implicitly to the bridge while their
channel is in it. You can now no longer unsubscribe from the implicit
subscription created by your channel: you may decrement the subscription count,
but it won't be sufficient to nuke out the subscription that ARI has created
for you.

This behaviour change is a good thing: If you have a channel in an application,
and it is doing "things", you should always be notified of the "things" it
is doing. Even if you claim you don't want to know - otherwise, how do you know
when you can DELETE the channel? Or do something else crazy to it?

This test has now been updated so that the thing unsubscribed is the
'bridge-watching-app'. This still verifies subscribes/unsubscribes - but it
does so where the entity subscribing for the bridge updates never had a 'stake'
in the state of the bridge in the first place.

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

Modified:
    asterisk/trunk/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py
    asterisk/trunk/tests/rest_api/applications/subscribe-bridge/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=4904&r1=4903&r2=4904
==============================================================================
--- asterisk/trunk/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py (original)
+++ asterisk/trunk/tests/rest_api/applications/subscribe-bridge/subscribe_bridge.py Thu Mar 27 23:02:35 2014
@@ -38,8 +38,8 @@
     assert TEST.bridge_id == event['bridge']['id']
     assert TEST.channel_id == event['channel']['id']
 
-    # now unsubscribe testsuite from the bridge.
-    ari.delete('applications', 'testsuite', 'subscription',
+    # now unsubscribe testsuite from the bridge-watching-app
+    ari.delete('applications', 'bridge-watching-app', 'subscription',
              eventSource='bridge:%s' % TEST.bridge_id)
 
     # upon removing the channel testsuite should receive no event, but

Modified: asterisk/trunk/tests/rest_api/applications/subscribe-bridge/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/applications/subscribe-bridge/test-config.yaml?view=diff&rev=4904&r1=4903&r2=4904
==============================================================================
--- asterisk/trunk/tests/rest_api/applications/subscribe-bridge/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/applications/subscribe-bridge/test-config.yaml Thu Mar 27 23:02:35 2014
@@ -1,8 +1,11 @@
 testinfo:
-    summary: Test continuing on from the RESTful API back to the dialplan
+    summary: Test subscribing/unsubscribing to bridges
     description: |
-        This test simply waits for a call via the WebSocket, then hits the
-        continue controller to send it back to the dialplan.
+        This test subscribes an application to a bridge and
+        verifies that the application gets events in relation
+        to that bridge. It then unsubscribes the application
+        from that bridge, and verifies that it no longer
+        receives any notifications.
 
 test-modules:
     add-test-to-search-path: True
@@ -42,18 +45,17 @@
                     application: testsuite
                     bridge:
                     channel:
-            count: 0 # event should not happen since the 'testsuite'
-                     # application won't be subscribed by raise time
+            count: 1
+            callback:
+                module: subscribe_bridge
+                method: on_channel_left_bridge
         -   conditions:
                 match:
                     type: ChannelLeftBridge
                     application: bridge-watching-app
                     bridge:
                     channel:
-            count: 1
-            callback:
-                module: subscribe_bridge
-                method: on_channel_left_bridge
+            count: 0
 
 properties:
     minversion: '12.0.0'




More information about the asterisk-commits mailing list