[asterisk-dev] [Code Review]: Get CDR Congestion Logging Test (and improving whole concept behind CDRTestCase) working.

wdoekes reviewboard at asterisk.org
Tue Nov 22 16:04:36 CST 2011



> On Nov. 22, 2011, 2:19 p.m., mjordan wrote:
> > /asterisk/team/group/cdr_test_log_congestion/lib/python/asterisk/CDRTestCase.py, line 55
> > <https://reviewboard.asterisk.org/r/1552/diff/4/?file=21618#file21618line55>
> >
> >     I'm not entirely sure this is the best data structure for the job.  I'm assuming you need to store multiple CDR files and their records together.  Based on how you store the data, it looks like you really would do better with a dictionary of lists.  The key is the filename, and you just append to the list.  So you have:
> >     
> >     self.CDRFileExpectations[filename].append(cdrline)
> >     
> >     You'll have to do a bit of checking the first time you append, although with python, I don't think its much.

>>> from collections import defaultdict
>>> CDRFileExpectations = defaultdict(list)
>>> CDRFileExpectations['fileA'].append('a')
>>> CDRFileExpectations['fileA'].append('b')
>>> CDRFileExpectations['fileB'].append('something else')
>>> CDRFileExpectations
defaultdict(<type 'list'>, {'fileB': ['something else'], 'fileA': ['a', 'b']})


- wdoekes


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1552/#review4844
-----------------------------------------------------------


On Nov. 4, 2011, 8:56 a.m., jrose wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1552/
> -----------------------------------------------------------
> 
> (Updated Nov. 4, 2011, 8:56 a.m.)
> 
> 
> Review request for Asterisk Developers, Paul Belanger and mjordan.
> 
> 
> Summary
> -------
> 
> A while back, Pabelanger and I were working on creating a general method of testing CDR logging.  At the time, we sort of hit a wall with the order individual call logs were being stuffed into the master cdr file.
> 
> In order to alleviate that, this patch changes the CDRTestCase class to use CDR files generated based on account codes.  At the moment, I'm just specifically using a testsuite account code and loading that cdr file, but it isn't a stretch to say we could put in multiple account codes and use a bunch of different cdr logs so that the order of which channel hangs up isn't important.
> 
> In addition to that, a couple minor changes were made to the cdr_originate_sip_congestion_log test.  It now runs without any chance for timing based failures (before it was 50/50 whether congestion or failure would come first/second, now only one action is checked and logged, that being the congestion).
> 
> If this seems appropriate, I'll move forward with making the CDR Expectations use a variable to determine which file they should be checking against.
> 
> 
> Diffs
> -----
> 
>   /asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/manager.general.conf.inc 2675 
>   /asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/sip.conf 2675 
>   /asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/run-test 2675 
>   /asterisk/team/group/cdr_test_log_congestion/tests/cdr/cdr_originate_sip_congestion_log/configs/ast1/extensions.conf 2675 
>   /asterisk/team/group/cdr_test_log_congestion/lib/python/asterisk/CDRTestCase.py 2675 
> 
> Diff: https://reviewboard.asterisk.org/r/1552/diff
> 
> 
> Testing
> -------
> 
> Checked to see how the test was logging CDR in separate files, made sure test was passing appropriately.
> 
> 
> Thanks,
> 
> jrose
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20111122/02c957cc/attachment.htm>


More information about the asterisk-dev mailing list