[asterisk-commits] coreyfarrell: testsuite/asterisk/trunk r4737 - in /asterisk/trunk/tests/cdr: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 26 09:03:43 CST 2014


Author: coreyfarrell
Date: Wed Feb 26 09:03:38 2014
New Revision: 4737

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4737
Log:
Fix originate-cdr-disposition failure reporting

* Use proper True/False values in config instead of 'yes'/'no'.
* Catch all exceptions from Originate, print a short error instead
  of a backtrace.
* Flag the test for failure when a non-ignored originate fails.

(closes issue ASTERISK-23352)
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/3263/

Modified:
    asterisk/trunk/tests/cdr/cdr-tests.py
    asterisk/trunk/tests/cdr/originate-cdr-disposition/test-config.yaml

Modified: asterisk/trunk/tests/cdr/cdr-tests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr-tests.py?view=diff&rev=4737&r1=4736&r2=4737
==============================================================================
--- asterisk/trunk/tests/cdr/cdr-tests.py (original)
+++ asterisk/trunk/tests/cdr/cdr-tests.py Wed Feb 26 09:03:38 2014
@@ -32,6 +32,7 @@
         self.module_config = module_config
         test_object.register_scenario_started_observer(self.scenario_started)
         test_object.register_ami_observer(self.ami_connect)
+        self.test_object = test_object
         self.ami = None
         self.test_counter = 0
 
@@ -46,13 +47,16 @@
         self.test_counter += 1
         return result
 
+    def originate_response(self, reason, ignore):
+        ''' Absorb an exception thrown by an Originate failure '''
+        if ignore:
+            LOGGER.debug('Ignoring originate failure...')
+        else:
+            LOGGER.error("Unexpected originate failure...")
+            self.test_object.set_passed(False)
+
     def originate_call(self):
         ''' Originate a new call '''
-
-        def failure_absorber(reason):
-            ''' Absorb an exception thrown by an Originate failure '''
-            LOGGER.debug('Ignoring originate failure...')
-            return reason
 
         if self.test_counter > (len(self.module_config) - 1):
             LOGGER.debug('Ignoring scenario start; no more calls to originate')
@@ -60,8 +64,7 @@
         originate_obj = self.module_config[self.test_counter]
         defered = self.ami.originate(**originate_obj['parameters'])
         ignore_failures = originate_obj.get('ignore-originate-failure') or False
-        if ignore_failures:
-            defered.addErrback(failure_absorber)
+        defered.addErrback(self.originate_response, ignore_failures)
 
 
 

Modified: asterisk/trunk/tests/cdr/originate-cdr-disposition/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/originate-cdr-disposition/test-config.yaml?view=diff&rev=4737&r1=4736&r2=4737
==============================================================================
--- asterisk/trunk/tests/cdr/originate-cdr-disposition/test-config.yaml (original)
+++ asterisk/trunk/tests/cdr/originate-cdr-disposition/test-config.yaml Wed Feb 26 09:03:38 2014
@@ -63,19 +63,19 @@
 sequence-originator:
     -
         parameters: { channel: 'sip/test1', context: 'default', exten: 'wait', priority: '1' }
-        ignore-originate-failure: 'no'
+        ignore-originate-failure: False
     -
         parameters: { channel: 'sip/test1', context: 'default', exten: 'wait', priority: '1' }
-        ignore-originate-failure: 'no'
+        ignore-originate-failure: False
     -
         parameters: { channel: 'sip/test1', context: 'default', exten: 'wait', priority: '1' }
-        ignore-originate-failure: 'no'
+        ignore-originate-failure: False
     -
         parameters: { channel: 'sip/test1', context: 'default', exten: 'wait', priority: '1', timeout: 1 }
-        ignore-originate-failure: 'yes'
+        ignore-originate-failure: True
     -
         parameters: { channel: 'sip/test1', context: 'default', exten: 'dial', priority: '1' }
-        ignore-originate-failure: 'yes'
+        ignore-originate-failure: True
 
 
 test-object-config:




More information about the asterisk-commits mailing list