[asterisk-dev] Change in testsuite[master]: rest_api/channels/snoop_spy: Stop test on bridge destruction

Joshua Colp (Code Review) asteriskteam at digium.com
Wed Apr 1 17:48:17 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: rest_api/channels/snoop_spy: Stop test on bridge destruction
......................................................................


rest_api/channels/snoop_spy: Stop test on bridge destruction

The snoop_spy test is currently bouncing on the CI build agents. This is due to
a race condition in the test:
* The test wants to verify that three StasisEnd events have occurred. When all
  events have occurred, it will destroy the bridge to clean up resources.
* At the same time, the twisted reactor will be stopped by the test object when
  the Local channel it spawned is hung up.

This causes a race condition, as the Local channel hangup is not ordered with
respect to the StasisEnd events received by the test. As a result, the
WebSocket connection may be broken before all StasisEnd events have been
received.

This patch fixes this by:
1. Instructing the test object to not stop the test when the Local channel has
   been destroyed.
2. Introducing a new instance of a pluggable module to watch for the
   'BridgeDestroyed' event. Since there is only one bridge in the test being
   destroyed at the very end of the test, this is easy to watch for.
3. When said event is received, stop the test.

This guarantees that the test will finish to completion, and all resources are
reclaimed prior to stopping Asterisk.

Change-Id: I373981f81ca455743bbf2371f07b380d013cd12b
---
M tests/rest_api/channels/snoop_spy/test-config.yaml
1 file changed, 13 insertions(+), 0 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/tests/rest_api/channels/snoop_spy/test-config.yaml b/tests/rest_api/channels/snoop_spy/test-config.yaml
index 2d9283a..10150d3 100644
--- a/tests/rest_api/channels/snoop_spy/test-config.yaml
+++ b/tests/rest_api/channels/snoop_spy/test-config.yaml
@@ -14,15 +14,28 @@
         -
             config-section: ami-uut
             typename: 'ami.AMIEventModule'
+        -
+            config-section: ari-test-stopper
+            typename: pluggable_modules.EventActionModule
 
 test-object-config:
     reactor-timeout: 60
+    stop-on-end: False
     test-iterations:
         -
             -   channel: Local/s at default
                 application: Playback
                 data: demo-congrats
 
+
+ari-test-stopper:
+    -
+        ari-events:
+            match:
+                type: BridgeDestroyed
+                application: testsuite
+        stop_test:
+
 ami-uut:
     -
         type: 'headermatch'

-- 
To view, visit https://gerrit.asterisk.org/21
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I373981f81ca455743bbf2371f07b380d013cd12b
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-dev mailing list