[asterisk-commits] coreyfarrell: testsuite/asterisk/trunk r6381 - in /asterisk/trunk/tests: chan...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 11 11:08:57 CST 2015


Author: coreyfarrell
Date: Wed Feb 11 11:08:54 2015
New Revision: 6381

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=6381
Log:
Fix a number of tests where Asterisk does not shutdown gracefully.

* Add Hangup() to priority after Dial() where needed.  This prevents
  auto-fallthrough from playing 10 seconds of BUSY or CONGESTION tone.
* Decrease Wait(10) to Wait(5) in tests/channels/SIP/info_dtmf.
* Maintain list of AGI connections where needed so they can all be
  agi.finish().
* Replace calls to reactor.stop() with self.stop_reactor(), remove
  test.start_asterisk()/test.stop_asterisk() from main().
* Delay self.stop_reactor() in tests/channels/SIP/sip_tls_call by 2 seconds.
  This gives the calls enough time to end and avoid shutdown timeout.

Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4411/

Modified:
    asterisk/trunk/tests/channels/SIP/generic_ccss/configs/ast1/extensions.conf
    asterisk/trunk/tests/channels/SIP/hangupcause/configs/ast1/extensions.conf
    asterisk/trunk/tests/channels/SIP/info_dtmf/configs/ast1/extensions.conf
    asterisk/trunk/tests/channels/SIP/noload_res_srtp/run-test
    asterisk/trunk/tests/channels/SIP/secure_bridge_media/run-test
    asterisk/trunk/tests/channels/SIP/sip_cause/configs/ast1/extensions.conf
    asterisk/trunk/tests/channels/SIP/sip_srtp/run-test
    asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test
    asterisk/trunk/tests/fastagi/control-stream-file/run-test
    asterisk/trunk/tests/fastagi/database/run-test
    asterisk/trunk/tests/fastagi/stream-file/run-test
    asterisk/trunk/tests/funcs/func_presencestate/run-test
    asterisk/trunk/tests/funcs/func_srv/run-test

Modified: asterisk/trunk/tests/channels/SIP/generic_ccss/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/generic_ccss/configs/ast1/extensions.conf?view=diff&rev=6381&r1=6380&r2=6381
==============================================================================
--- asterisk/trunk/tests/channels/SIP/generic_ccss/configs/ast1/extensions.conf (original)
+++ asterisk/trunk/tests/channels/SIP/generic_ccss/configs/ast1/extensions.conf Wed Feb 11 11:08:54 2015
@@ -25,6 +25,7 @@
 [dial-alice]
 exten => _X.,1,answer
 exten => _X.,n,dial(sip/alice/${EXTEN})
+exten => _X.,n,hangup
 
 [dial-bob]
 exten => _X.,1,answer

Modified: asterisk/trunk/tests/channels/SIP/hangupcause/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/hangupcause/configs/ast1/extensions.conf?view=diff&rev=6381&r1=6380&r2=6381
==============================================================================
--- asterisk/trunk/tests/channels/SIP/hangupcause/configs/ast1/extensions.conf (original)
+++ asterisk/trunk/tests/channels/SIP/hangupcause/configs/ast1/extensions.conf Wed Feb 11 11:08:54 2015
@@ -15,3 +15,4 @@
 [dial-alice]
 exten => _X.,1,Answer()
 exten => _X.,n,Dial(sip/alice/${EXTEN})
+exten => _X.,n,Hangup()

Modified: asterisk/trunk/tests/channels/SIP/info_dtmf/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/info_dtmf/configs/ast1/extensions.conf?view=diff&rev=6381&r1=6380&r2=6381
==============================================================================
--- asterisk/trunk/tests/channels/SIP/info_dtmf/configs/ast1/extensions.conf (original)
+++ asterisk/trunk/tests/channels/SIP/info_dtmf/configs/ast1/extensions.conf Wed Feb 11 11:08:54 2015
@@ -3,5 +3,5 @@
 exten => _.,1,NoOp()
 
 exten => test,1,Answer()
-exten => test,n,Wait(10)
+exten => test,n,Wait(5)
 exten => test,n,HangUp()

Modified: asterisk/trunk/tests/channels/SIP/noload_res_srtp/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/noload_res_srtp/run-test?view=diff&rev=6381&r1=6380&r2=6381
==============================================================================
--- asterisk/trunk/tests/channels/SIP/noload_res_srtp/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/noload_res_srtp/run-test Wed Feb 11 11:08:54 2015
@@ -23,6 +23,7 @@
         self.connected_chan2 = False
         self.connected_no_srtp1 = False
         self.connected_no_srtp2 = False
+        self.agis = []
 
         # Create one AGI server
         # Will call fastagi_connect() once an AGI connection is established.
@@ -58,13 +59,17 @@
 
             if self.connected_chan1 and self.connected_no_srtp1 and self.connected_chan2 and self.connected_no_srtp2:
                 print "Test passed"
+                for a in self.agis:
+                    a.finish()
+                self.agis = []
                 self.passed = True
-                reactor.stop()
+                self.stop_reactor()
             # Hold the AGI connection until the reactor times out
             # so the other side has a chance to get its test result.
             ## Drop the AGI connection
             #agi.finish()
 
+        self.agis.append(agi)
         agi.getVariable("TEST_RESULT").addCallback(get_test_result)
 
     def stop_asterisk(self):
@@ -78,9 +83,8 @@
 
 def main():
     test = SIPCallTest()
-    test.start_asterisk()
     reactor.run()
-    test.stop_asterisk()
+
     if test.passed:
         return 0
     return 1

Modified: asterisk/trunk/tests/channels/SIP/secure_bridge_media/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/secure_bridge_media/run-test?view=diff&rev=6381&r1=6380&r2=6381
==============================================================================
--- asterisk/trunk/tests/channels/SIP/secure_bridge_media/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/secure_bridge_media/run-test Wed Feb 11 11:08:54 2015
@@ -61,7 +61,7 @@
             if self.connected_chan2 and self.connected_srtp2:
                 print "Test passed"
                 self.passed = True
-                reactor.stop()
+                self.stop_reactor()
 
         agi.getVariable("TEST_RESULT").addCallback(get_test_result)
 
@@ -71,9 +71,7 @@
 
 def main():
     test = SIPCallTest()
-    test.start_asterisk()
     reactor.run()
-    test.stop_asterisk()
     if test.passed:
         return 0
     return 1

Modified: asterisk/trunk/tests/channels/SIP/sip_cause/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_cause/configs/ast1/extensions.conf?view=diff&rev=6381&r1=6380&r2=6381
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_cause/configs/ast1/extensions.conf (original)
+++ asterisk/trunk/tests/channels/SIP/sip_cause/configs/ast1/extensions.conf Wed Feb 11 11:08:54 2015
@@ -15,3 +15,4 @@
 [dial-alice]
 exten => _X.,1,Answer()
 exten => _X.,n,Dial(sip/alice/${EXTEN})
+exten => _X.,n,Hangup()

Modified: asterisk/trunk/tests/channels/SIP/sip_srtp/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_srtp/run-test?view=diff&rev=6381&r1=6380&r2=6381
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_srtp/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_srtp/run-test Wed Feb 11 11:08:54 2015
@@ -27,6 +27,7 @@
         # Create one AGI server
         # Will call fastagi_connect() once an AGI connection is established.
         self.create_fastagi_factory()
+        self.agis = []
 
         # Create two Asterisk instances ...
         self.create_asterisk(2)
@@ -57,13 +58,17 @@
 
             if self.connected_chan1 and self.connected_srtp1 and self.connected_chan2 and self.connected_srtp2:
                 print "Test passed"
+                for a in self.agis:
+                    a.finish()
+                self.agis = []
                 self.passed = True
-                reactor.stop()
+                self.stop_reactor()
             # Hold the AGI connection until the reactor times out
             # so the other side has a chance to get its test result.
             ## Drop the AGI connection
             #agi.finish()
 
+        self.agis.append(agi)
         agi.getVariable("TEST_RESULT").addCallback(get_test_result)
 
     def stop_asterisk(self):
@@ -71,9 +76,8 @@
 
 def main():
     test = SIPCallTest()
-    test.start_asterisk()
     reactor.run()
-    test.stop_asterisk()
+
     if test.passed:
         return 0
     return 1

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=6381&r1=6380&r2=6381
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_tls_call/run-test Wed Feb 11 11:08:54 2015
@@ -96,7 +96,7 @@
         if self.tone1 and self.tone2:
             LOGGER.info("Both tones have matched at least once. Test PASSED.")
             self.passed = True
-            self.stop_reactor()
+            reactor.callLater(2, self.stop_reactor)
 
     def run(self):
         TestCase.run(self)

Modified: asterisk/trunk/tests/fastagi/control-stream-file/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fastagi/control-stream-file/run-test?view=diff&rev=6381&r1=6380&r2=6381
==============================================================================
--- asterisk/trunk/tests/fastagi/control-stream-file/run-test (original)
+++ asterisk/trunk/tests/fastagi/control-stream-file/run-test Wed Feb 11 11:08:54 2015
@@ -38,6 +38,7 @@
                 self.passed = True
             else:
                 LOGGER.error("Unexpected result '%r'", result)
+            self.agi.finish()
         finally:
             self.stop_reactor()
 

Modified: asterisk/trunk/tests/fastagi/database/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fastagi/database/run-test?view=diff&rev=6381&r1=6380&r2=6381
==============================================================================
--- asterisk/trunk/tests/fastagi/database/run-test (original)
+++ asterisk/trunk/tests/fastagi/database/run-test Wed Feb 11 11:08:54 2015
@@ -156,6 +156,7 @@
         # if self.passed["Put"] is None, not one test has completed yet
         # and we should wait for the timeout.
         if self.passed["Put"] is not None:
+            self.agi.finish()
             self.stop_reactor()
             for test in self.passed:
                 if self.passed[test] is False:

Modified: asterisk/trunk/tests/fastagi/stream-file/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fastagi/stream-file/run-test?view=diff&rev=6381&r1=6380&r2=6381
==============================================================================
--- asterisk/trunk/tests/fastagi/stream-file/run-test (original)
+++ asterisk/trunk/tests/fastagi/stream-file/run-test Wed Feb 11 11:08:54 2015
@@ -26,12 +26,14 @@
     def finish_test(self, result):
         if result[0] == 0 and result[1] > 100:
             self.passed = True
+        self.agi.finish()
         self.stop_reactor()
 
     # This gets invoked by the dialplan when the call is answered
     # send STREAM FILE command and wait for results
     def fastagi_connect(self, agi):
         print "Connection established."
+        self.agi = agi
         return agi.streamFile("beep", "").addCallback(
             self.finish_test)
 

Modified: asterisk/trunk/tests/funcs/func_presencestate/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/funcs/func_presencestate/run-test?view=diff&rev=6381&r1=6380&r2=6381
==============================================================================
--- asterisk/trunk/tests/funcs/func_presencestate/run-test (original)
+++ asterisk/trunk/tests/funcs/func_presencestate/run-test Wed Feb 11 11:08:54 2015
@@ -41,7 +41,7 @@
                 return
 
         self.passed = True
-        reactor.stop()
+        self.stop_reactor()
 
     def ami_connect(self, ami):
         self.ami[0].registerEvent("UserEvent", self.passOrFail)
@@ -54,9 +54,7 @@
 
 def main():
     test = func_presencestate_test()
-    test.start_asterisk()
     reactor.run()
-    test.stop_asterisk()
 
     if not test.passed:
         return 1

Modified: asterisk/trunk/tests/funcs/func_srv/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/funcs/func_srv/run-test?view=diff&rev=6381&r1=6380&r2=6381
==============================================================================
--- asterisk/trunk/tests/funcs/func_srv/run-test (original)
+++ asterisk/trunk/tests/funcs/func_srv/run-test Wed Feb 11 11:08:54 2015
@@ -68,11 +68,11 @@
                         # Records with the same priority are ordered randomly, so check 2/3 instead.
                         if not (r.record_num == 2 and r.match(t[2])) and not (r.record_num == 3 and r.match(t[1])):
                             print "Record #%s did not match." % r.record_num
-                            reactor.stop()
+                            self.stop_reactor()
                             return
 
             self.passed = True
-            reactor.stop()
+            self.stop_reactor()
 
     def run(self):
         TestCase.run(self)
@@ -80,9 +80,7 @@
 
 def main():
     test = func_srv_test()
-    test.start_asterisk()
     reactor.run()
-    test.stop_asterisk()
 
     if not test.passed:
         return 1




More information about the asterisk-commits mailing list