[asterisk-commits] russell: testsuite/asterisk/trunk r938 - /asterisk/trunk/tests/cdr/console_fo...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 24 11:50:47 CST 2010


Author: russell
Date: Wed Nov 24 11:50:43 2010
New Revision: 938

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=938
Log:
Don't hit an exception if the CDR file doesn't contain what we expect.

Modified:
    asterisk/trunk/tests/cdr/console_fork_after_busy_forward/run-test

Modified: asterisk/trunk/tests/cdr/console_fork_after_busy_forward/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/console_fork_after_busy_forward/run-test?view=diff&rev=938&r1=937&r2=938
==============================================================================
--- asterisk/trunk/tests/cdr/console_fork_after_busy_forward/run-test (original)
+++ asterisk/trunk/tests/cdr/console_fork_after_busy_forward/run-test Wed Nov 24 11:50:43 2010
@@ -60,6 +60,7 @@
     def end(self, ami, event):
         if event.get('channel').lower() != "console/dsp":
             return
+
         self.stop_asterisk()
         cdr1 = AsteriskCSVCDR(fn="%s/var/log/asterisk/cdr-csv/Master.csv" % (self.asterisk1.base))
         cdr2 = AsteriskCSVCDR(fn="%s/var/log/asterisk/cdr-csv/Master.csv" % (self.asterisk2.base))
@@ -84,6 +85,11 @@
             dchannel="", lastapp="Hangup", lastarg="", disposition="ANSWERED",
             amaflags="DOCUMENTATION")])
 
+        if len(cdr1) < 2:
+            print "Fewer cdr records than expected! (%d)" % len(cdr1)
+            reactor.stop()
+            return
+
         if int(cdr1[0].duration) < int(cdr1[1].duration):
             print "Fail: Original CDR duration shorter than forked"
             sys.exit(-1)
@@ -105,3 +111,5 @@
 
 if __name__ == '__main__':
     sys.exit(main())
+
+# vim:sw=4:ts=4:expandtab:textwidth=79




More information about the asterisk-commits mailing list