[asterisk-commits] coreyfarrell: testsuite/asterisk/trunk r6532 - in /asterisk/trunk/tests: apps...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 13 12:30:45 CDT 2015


Author: coreyfarrell
Date: Fri Mar 13 12:30:42 2015
New Revision: 6532

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=6532
Log:
Fix reference leaks and shutdown timeouts in more tests.

* apps/page/page_baseline: hangup channels ignoring errors.
* apps/queues/position_priority_maxlen: hangup channels.
* callparking_retrieval: hangup parkee.
* channels/SIP/sip_tls_call: hangup channel that gives the last DTMF event.
* channels/local/local_optimize_away: hangup all channels.
* rest_api/events/user/multi: add missing dependency chan_pjsip.
* rest_api/external_interaction/ami_bridge/stasis_bridge/non_stasis_app:
  delete the bridge.
* rest_api/request-bodies: delete the bridges.

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

Modified:
    asterisk/trunk/tests/apps/page/page_baseline/run-test
    asterisk/trunk/tests/apps/queues/position_priority_maxlen/run-test
    asterisk/trunk/tests/callparking_retrieval/run-test
    asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test
    asterisk/trunk/tests/channels/local/local_optimize_away/test-config.yaml
    asterisk/trunk/tests/rest_api/events/user/multi/test-config.yaml
    asterisk/trunk/tests/rest_api/external_interaction/ami_bridge/stasis_bridge/non_stasis_app/test-config.yaml
    asterisk/trunk/tests/rest_api/request-bodies/run-test

Modified: asterisk/trunk/tests/apps/page/page_baseline/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/page/page_baseline/run-test?view=diff&rev=6532&r1=6531&r2=6532
==============================================================================
--- asterisk/trunk/tests/apps/page/page_baseline/run-test (original)
+++ asterisk/trunk/tests/apps/page/page_baseline/run-test Fri Mar 13 12:30:42 2015
@@ -23,16 +23,28 @@
 
         self.reactor_timeout = 60
         self.create_asterisk()
+        self.channels = []
 
     def ami_connect(self, ami):
         self.ami[0].registerEvent("UserEvent", self.check_amd_status_result)
+        self.ami[0].registerEvent("Newchannel", self.ami_newchannel)
         self.ami[0].originate(channel = "IAX2/127.0.0.1/1000",
                               application = "Playback",
                               data = "demo-congrats")
 
+    def ami_newchannel(self, ami, event):
+        self.channels.append(event['channel'])
+
     def check_amd_status_result(self, ami, event):
+        def __hangup_ignore(result):
+            # Ignore hangup errors - if the channel is gone, we don't care
+            return
+
         if event.get("userevent").lower() != "amdevent":
             return
+
+        for x in self.channels:
+            ami.hangup(x).addErrback(__hangup_ignore)
 
         status = event.get("status")
         logger.debug("Status of AMD is %s" % (status))

Modified: asterisk/trunk/tests/apps/queues/position_priority_maxlen/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/queues/position_priority_maxlen/run-test?view=diff&rev=6532&r1=6531&r2=6532
==============================================================================
--- asterisk/trunk/tests/apps/queues/position_priority_maxlen/run-test (original)
+++ asterisk/trunk/tests/apps/queues/position_priority_maxlen/run-test Fri Mar 13 12:30:42 2015
@@ -48,9 +48,11 @@
         TestCase.__init__(self)
         self.create_asterisk()
         self.test_run = 0
+        self.channels = []
         self.passed = False
 
     def check_position(self, ami, event):
+        self.channels.append(event['channel'])
         position = int(event.get('position'))
         if position != TEST_RUNS[self.test_run]['ExpectedPosition']:
             LOGGER.error("Queue caller %d entered at unexpected position %d. \
@@ -73,6 +75,9 @@
         else:
             # This just so happens to be the final caller, so we're done!
             self.passed = True
+
+        for chan in self.channels:
+            ami.hangup(chan)
 
         self.stop_reactor()
 

Modified: asterisk/trunk/tests/callparking_retrieval/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/callparking_retrieval/run-test?view=diff&rev=6532&r1=6531&r2=6532
==============================================================================
--- asterisk/trunk/tests/callparking_retrieval/run-test (original)
+++ asterisk/trunk/tests/callparking_retrieval/run-test Fri Mar 13 12:30:42 2015
@@ -81,6 +81,7 @@
 
             LOGGER.info("All events matched expectations. Test Passed.")
             self.set_passed(True)
+            ami.hangup(parkee)
             self.stop_reactor()
 
     def check_unparkedcall(self, ami, event):

Modified: asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test?view=diff&rev=6532&r1=6531&r2=6532
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test Fri Mar 13 12:30:42 2015
@@ -95,6 +95,7 @@
 
         if self.tone1 and self.tone2:
             LOGGER.info("Both tones have matched at least once. Test PASSED.")
+            ami.hangup(event['channel'])
             self.passed = True
             reactor.callLater(2, self.stop_reactor)
 

Modified: asterisk/trunk/tests/channels/local/local_optimize_away/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/local_optimize_away/test-config.yaml?view=diff&rev=6532&r1=6531&r2=6532
==============================================================================
--- asterisk/trunk/tests/channels/local/local_optimize_away/test-config.yaml (original)
+++ asterisk/trunk/tests/channels/local/local_optimize_away/test-config.yaml Fri Mar 13 12:30:42 2015
@@ -26,6 +26,10 @@
             minversion: '12.0.0'
             config-section: ami-config-12
             typename: 'ami.AMIEventModule'
+        -
+            minversion: '12.0.0'
+            config-section: hangup-config-12
+            typename: 'pluggable_modules.AMIChannelHangupAll'
 
 test-object-config:
     expected_events: 0
@@ -73,3 +77,13 @@
                 LocalOneChannel: 'Local/dial_bar at default-.{7}0;1'
                 LocalTwoChannel: 'Local/dial_bar at default-.{7}0;2'
         count: '1'
+
+hangup-config-12:
+    type: 'headermatch'
+    delay: 2
+    conditions:
+        match:
+            Event: 'LocalOptimizationEnd'
+            LocalOneChannel: 'Local/dial_bar at default-.{7}0;1'
+            LocalTwoChannel: 'Local/dial_bar at default-.{7}0;2'
+

Modified: asterisk/trunk/tests/rest_api/events/user/multi/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/events/user/multi/test-config.yaml?view=diff&rev=6532&r1=6531&r2=6532
==============================================================================
--- asterisk/trunk/tests/rest_api/events/user/multi/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/events/user/multi/test-config.yaml Fri Mar 13 12:30:42 2015
@@ -296,6 +296,7 @@
         - python : twisted
         - python : starpy
         - asterisk : res_ari_channels
+        - asterisk : chan_pjsip
         - asterisk : app_echo
         - asterisk : app_userevent
     tags:

Modified: asterisk/trunk/tests/rest_api/external_interaction/ami_bridge/stasis_bridge/non_stasis_app/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/external_interaction/ami_bridge/stasis_bridge/non_stasis_app/test-config.yaml?view=diff&rev=6532&r1=6531&r2=6532
==============================================================================
--- asterisk/trunk/tests/rest_api/external_interaction/ami_bridge/stasis_bridge/non_stasis_app/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/external_interaction/ami_bridge/stasis_bridge/non_stasis_app/test-config.yaml Fri Mar 13 12:30:42 2015
@@ -112,6 +112,9 @@
                     Event: Hangup
                     uniqueid: 'EchoChannel'
             count: 1
+        ari-requests:
+            method: 'delete'
+            uri: 'bridges/test_bridge'
         stop_test:
 
 properties:

Modified: asterisk/trunk/tests/rest_api/request-bodies/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/request-bodies/run-test?view=diff&rev=6532&r1=6531&r2=6532
==============================================================================
--- asterisk/trunk/tests/rest_api/request-bodies/run-test (original)
+++ asterisk/trunk/tests/rest_api/request-bodies/run-test Fri Mar 13 12:30:42 2015
@@ -51,6 +51,7 @@
         form = {"type": "holding"}
         resp = requests.post(build_url('ari', 'bridges'), data=form)
         resp.raise_for_status()
+        requests.delete(build_url('ari', 'bridges', resp.json()['id']))
         actual_bridge_type = resp.json()['bridge_type']
         if 'holding' != actual_bridge_type:
             LOGGER.error("Unexpected bridge type: %s" % actual_bridge_type)
@@ -62,6 +63,7 @@
         resp = requests.post(build_url('ari', 'bridges'), data=body,
                              headers=headers)
         resp.raise_for_status()
+        requests.delete(build_url('ari', 'bridges', resp.json()['id']))
         actual_bridge_type = resp.json()['bridge_type']
         if 'holding' != actual_bridge_type:
             LOGGER.error("Unexpected bridge type: %s" % actual_bridge_type)




More information about the asterisk-commits mailing list