[asterisk-commits] jrose: branch group/cdr_test_log_congestion r2676 - in /asterisk/team/group/c...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Nov 4 09:00:55 CDT 2011
Author: jrose
Date: Fri Nov 4 09:00:51 2011
New Revision: 2676
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=2676
Log:
Multiple CDR file support committed to the branch.
Modified:
asterisk/team/group/cdr_test_log_congestion/lib/python/asterisk/CDRTestCase.py
asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/extensions.conf
asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/manager.general.conf.inc
asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/sip.conf
asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/run-test
Modified: asterisk/team/group/cdr_test_log_congestion/lib/python/asterisk/CDRTestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/cdr_test_log_congestion/lib/python/asterisk/CDRTestCase.py?view=diff&rev=2676&r1=2675&r2=2676
==============================================================================
--- asterisk/team/group/cdr_test_log_congestion/lib/python/asterisk/CDRTestCase.py (original)
+++ asterisk/team/group/cdr_test_log_congestion/lib/python/asterisk/CDRTestCase.py Fri Nov 4 09:00:51 2011
@@ -27,7 +27,7 @@
def __init__(self):
TestCase.__init__(self):
self.add_expectation(AsteriskCSVCDRLine(
- accountcode='',
+ accountcode='testsuite',
source='',
destination='1',
dcontext='default',
@@ -45,16 +45,16 @@
return test.results()
"""
- CDRLineExpectations = []
-
def __init__(self):
""""
Create a single Asterisk instance.
"""
TestCase.__init__(self)
+ self.CDRFileExpectations = []
self.create_asterisk()
- def add_expectation(self, cdrline):
+
+ def add_expectation(self, filename, cdrline):
"""
Add an expectation to the expectation list
@@ -67,25 +67,36 @@
channel="SIP/test-00000000", disposition="CONGESTION",
amaflags="DOCUMENTATION"))
"""
- self.CDRLineExpectations.append([cdrline])
+ for i in self.CDRFileExpectations:
+ if i and i[0] == filename:
+ i.append(cdrline)
+ return
+
+ self.CDRFileExpectations.append([])
+ self.CDRFileExpectations[len(self.CDRFileExpectations) - 1].append(filename)
+ self.CDRFileExpectations[len(self.CDRFileExpectations) - 1].append(cdrline)
def __match_cdrs(self):
+ #Automatically invoked at the end of the test, this will test the CDR files against the listed expectations.
- # We'll store the cdrlines for an individual instance of Asterisk in here
- records = []
+ self.passed = True
+ for i in self.CDRFileExpectations:
+ # We'll store the cdrlines for an individual instance of Asterisk in here
+ records = []
- # Build records with just the cdrlines that belong to this instance of Asterisk
- for count, cdrline in enumerate(self.CDRLineExpectations):
- records.append(cdrline[0])
+ # Build records with just the cdrlines that belong to this instance of Asterisk
+ for j in range(1,len(i)):
+ records.append(i[j])
- # Now make a cdr from records and load the cdr from the ast instance
- cdr_expect = AsteriskCSVCDR(records=records)
- cdr_file = AsteriskCSVCDR(fn="%s/%s/cdr-csv/Master.csv" %
- (self.ast[0].base, self.ast[0].directories['astlogdir']))
+ cdr_expect = AsteriskCSVCDR(records=records)
+ cdr_file = AsteriskCSVCDR(fn="%s/%s/cdr-csv/%s.csv" % (self.ast[0].base, self.ast[0].directories['astlogdir'], i[0]))
- # Now match test the match:
- if cdr_expect.match(cdr_file):
- self.passed = True
+ if cdr_expect.match(cdr_file):
+ logger.debug("%s.csv - CDR results met expectations" % i[0])
+ else:
+ logger.debug("%s.csv - CDR results did not meet expectations. Test Failed." % i[0])
+ self.passed = False
+
def results(self):
"""
Modified: asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/extensions.conf?view=diff&rev=2676&r1=2675&r2=2676
==============================================================================
--- asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/extensions.conf (original)
+++ asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/extensions.conf Fri Nov 4 09:00:51 2011
@@ -6,7 +6,7 @@
[default]
exten => 1,1,NoOp()
- same => n,NoCDR()
+ same => n,Set(CDR(accountcode)=cdrtest_local)
same => n,Dial(SIP/test/2)
exten => 2,1,NoOp()
Modified: asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/manager.general.conf.inc?view=diff&rev=2676&r1=2675&r2=2676
==============================================================================
--- asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/manager.general.conf.inc (original)
+++ asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/manager.general.conf.inc Fri Nov 4 09:00:51 2011
@@ -1,1 +1,0 @@
-enabled = yes
Modified: asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/sip.conf?view=diff&rev=2676&r1=2675&r2=2676
==============================================================================
--- asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/sip.conf (original)
+++ asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/sip.conf Fri Nov 4 09:00:51 2011
@@ -5,3 +5,4 @@
[test]
type=peer
host=127.0.0.1
+accountcode=cdrtest_sip
Modified: asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/run-test?view=diff&rev=2676&r1=2675&r2=2676
==============================================================================
--- asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/run-test (original)
+++ asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/run-test Fri Nov 4 09:00:51 2011
@@ -18,18 +18,8 @@
def __init__(self):
CDRTestCase.__init__(self)
- self.add_expectation(AsteriskCSVCDRLine(
- accountcode='',
- source='',
- destination='1',
- dcontext='default',
- callerid='',
- channel='Local/1 at default-.*',
- disposition='FAILED',
- amaflags='DOCUMENTATION'
- ))
- self.add_expectation(AsteriskCSVCDRLine(
- accountcode='',
+
+ self.add_expectation('cdrtest_sip', AsteriskCSVCDRLine(
source='Anonymous',
destination='2',
dcontext='default',
@@ -39,6 +29,12 @@
amaflags='DOCUMENTATION'
))
+ self.add_expectation('cdrtest_local', AsteriskCSVCDRLine(
+ destination='1',
+ dcontext='default',
+ disposition='CONGESTION',
+ amaflags='DOCUMENTATION'
+ ))
def main():
test = CDRCongestionLogTest()
@@ -52,3 +48,4 @@
sys.exit(main())
# vim:sw=4:ts=4:expandtab:textwidth=79
+
More information about the asterisk-commits
mailing list