[asterisk-commits] mjordan: testsuite/asterisk/trunk r4080 - in /asterisk/trunk: lib/python/aste...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Aug 25 20:42:20 CDT 2013


Author: mjordan
Date: Sun Aug 25 20:42:19 2013
New Revision: 4080

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4080
Log:
Give several CDR tests a chance to finish

A few revisions back, these tests passed. Unfortunately, they passed because
originated channels were leaked, which meant that a 'core stop gracefully'
wouldn't actually stop Asterisk. On the plus side, this gave the CDR engine
a chance to log out the results; on the negative side, memory leaks.

Essentially we're so fast on killing these tests that on slow enough build
agents, there's a good chance Asterisk will unload the CDR CSV modules and be
shutting down before the test writes out the CDR entry. Making the origination
asynchronous helped, but not quite enough.

This patch lets the SimpleTestCase module delay shutting down. If we can't
get the CDRs written in a few seconds then, quite frankly, we deserve to fail.
And I'll have to try to figure out yet another solution to a racey problem.

Modified:
    asterisk/trunk/lib/python/asterisk/SimpleTestCase.py
    asterisk/trunk/tests/cdr/cdr_manipulation/console_fork_after_busy_forward/test-config.yaml
    asterisk/trunk/tests/cdr/cdr_manipulation/console_fork_before_dial/test-config.yaml
    asterisk/trunk/tests/cdr/console_dial_sip_answer/test-config.yaml
    asterisk/trunk/tests/cdr/console_dial_sip_busy/test-config.yaml
    asterisk/trunk/tests/cdr/console_dial_sip_congestion/test-config.yaml
    asterisk/trunk/tests/cdr/console_dial_sip_transfer/test-config.yaml

Modified: asterisk/trunk/lib/python/asterisk/SimpleTestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/SimpleTestCase.py?view=diff&rev=4080&r1=4079&r2=4080
==============================================================================
--- asterisk/trunk/lib/python/asterisk/SimpleTestCase.py (original)
+++ asterisk/trunk/lib/python/asterisk/SimpleTestCase.py Sun Aug 25 20:42:19 2013
@@ -10,6 +10,8 @@
 import sys
 import logging
 import uuid
+
+from twisted.internet import reactor
 
 sys.path.append("lib/python")
 from TestCase import TestCase
@@ -44,6 +46,7 @@
         self._ignore_originate_failures = False
         self._spawn_after_hangup = False
         self._config_path = None
+        self._end_test_delay = 0
 
         if test_config is None or 'test-iterations' not in test_config:
             # No special test configuration defined, use defaults
@@ -64,6 +67,8 @@
                 self._spawn_after_hangup = test_config['spawn-after-hangup']
             if 'config-path' in test_config:
                 self._config_path = test_config['config-path']
+            self._end_test_delay = test_config.get('end-test-delay') or 0
+
         self.create_asterisk(count=1, base_configs_path=self._config_path)
 
     def ami_connect(self, ami):
@@ -166,7 +171,7 @@
             self.__originate_call(ami, self._test_runs[self._current_run])
         else:
             LOGGER.info("All calls executed, stopping")
-            self.stop_reactor()
+            reactor.callLater(self._end_test_delay, self.stop_reactor)
 
 
     def __event_cb(self, ami, event):
@@ -196,7 +201,7 @@
         ''' Called when an error occurs during a hangup '''
         # Ignore the hangup error - in this case, the channel was disposed of
         # prior to our hangup request, which is okay
-        self.stop_reactor()
+        reactor.callLater(self._end_test_delay, self.stop_reactor)
 
     def verify_event(self, event):
         ''' Virtual method used to verify values in the event. '''

Modified: asterisk/trunk/tests/cdr/cdr_manipulation/console_fork_after_busy_forward/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr_manipulation/console_fork_after_busy_forward/test-config.yaml?view=diff&rev=4080&r1=4079&r2=4080
==============================================================================
--- asterisk/trunk/tests/cdr/cdr_manipulation/console_fork_after_busy_forward/test-config.yaml (original)
+++ asterisk/trunk/tests/cdr/cdr_manipulation/console_fork_after_busy_forward/test-config.yaml Sun Aug 25 20:42:19 2013
@@ -28,6 +28,7 @@
     config-path: 'tests/cdr/configs/basic'
     spawn-after-hangup: True
     ignore-originate-failures: True
+    end-test-delay: 2
     test-iterations:
         -
             channel: 'Local/1 at default'

Modified: asterisk/trunk/tests/cdr/cdr_manipulation/console_fork_before_dial/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr_manipulation/console_fork_before_dial/test-config.yaml?view=diff&rev=4080&r1=4079&r2=4080
==============================================================================
--- asterisk/trunk/tests/cdr/cdr_manipulation/console_fork_before_dial/test-config.yaml (original)
+++ asterisk/trunk/tests/cdr/cdr_manipulation/console_fork_before_dial/test-config.yaml Sun Aug 25 20:42:19 2013
@@ -20,6 +20,7 @@
 test-object-config:
     config-path: 'tests/cdr/configs/basic'
     spawn-after-hangup: True
+    end-test-delay: 2
     test-iterations:
         -
             channel: 'Local/1 at default'

Modified: asterisk/trunk/tests/cdr/console_dial_sip_answer/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/console_dial_sip_answer/test-config.yaml?view=diff&rev=4080&r1=4079&r2=4080
==============================================================================
--- asterisk/trunk/tests/cdr/console_dial_sip_answer/test-config.yaml (original)
+++ asterisk/trunk/tests/cdr/console_dial_sip_answer/test-config.yaml Sun Aug 25 20:42:19 2013
@@ -17,10 +17,12 @@
     config-path: 'tests/cdr/configs/basic'
     spawn-after-hangup: True
     ignore-originate-failures: True
+    end-test-delay: 2
     test-iterations:
         -
             channel: 'Local/1 at default'
             application: 'Echo'
+            async: True
 
 cdr-config:
     -

Modified: asterisk/trunk/tests/cdr/console_dial_sip_busy/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/console_dial_sip_busy/test-config.yaml?view=diff&rev=4080&r1=4079&r2=4080
==============================================================================
--- asterisk/trunk/tests/cdr/console_dial_sip_busy/test-config.yaml (original)
+++ asterisk/trunk/tests/cdr/console_dial_sip_busy/test-config.yaml Sun Aug 25 20:42:19 2013
@@ -17,6 +17,7 @@
     config-path: 'tests/cdr/configs/unanswered'
     spawn-after-hangup: True
     ignore-originate-failures: True
+    end-test-delay: 2
     test-iterations:
         -
             channel: 'Local/1 at default'

Modified: asterisk/trunk/tests/cdr/console_dial_sip_congestion/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/console_dial_sip_congestion/test-config.yaml?view=diff&rev=4080&r1=4079&r2=4080
==============================================================================
--- asterisk/trunk/tests/cdr/console_dial_sip_congestion/test-config.yaml (original)
+++ asterisk/trunk/tests/cdr/console_dial_sip_congestion/test-config.yaml Sun Aug 25 20:42:19 2013
@@ -17,6 +17,7 @@
     config-path: 'tests/cdr/configs/unanswered'
     spawn-after-hangup: True
     ignore-originate-failures: True
+    end-test-delay: 2
     test-iterations:
         -
             channel: 'Local/1 at default'

Modified: asterisk/trunk/tests/cdr/console_dial_sip_transfer/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/console_dial_sip_transfer/test-config.yaml?view=diff&rev=4080&r1=4079&r2=4080
==============================================================================
--- asterisk/trunk/tests/cdr/console_dial_sip_transfer/test-config.yaml (original)
+++ asterisk/trunk/tests/cdr/console_dial_sip_transfer/test-config.yaml Sun Aug 25 20:42:19 2013
@@ -23,6 +23,7 @@
     config-path: 'tests/cdr/configs/basic'
     spawn-after-hangup: True
     ignore-originate-failures: True
+    end-test-delay: 2
     test-iterations:
         -
             channel: 'Local/1 at default'




More information about the asterisk-commits mailing list