[Asterisk-code-review] Testsuite: Allow CDR test to specify CDR directory (testsuite[master])

Anonymous Coward asteriskteam at digium.com
Fri Oct 23 06:02:48 CDT 2015


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: Testsuite: Allow CDR test to specify CDR directory
......................................................................


Testsuite: Allow CDR test to specify CDR directory

On one of our internal test builds, cdr_csv is unavailable but we
still want to perform a CDR record check using the same parameters as
what we would expect from cdr_csv. Fortunately, cdr_custom can be used
to write a CDR log identical to what cdr_csv writes. However, since the
test class for CDR matching was written with cdr_csv in mind, we can't
tell it to use the cdr-custom folder. This patch will allow the test
yaml that defines the CDR match to specify which folder the CDR file
resides in.

Change-Id: I8148499a447a27129ca6620effcfc3bf7b40a0d4
---
M lib/python/asterisk/cdr.py
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved



diff --git a/lib/python/asterisk/cdr.py b/lib/python/asterisk/cdr.py
index 6380ed0..cc5226b 100644
--- a/lib/python/asterisk/cdr.py
+++ b/lib/python/asterisk/cdr.py
@@ -32,8 +32,11 @@
 
         # Build our expected CDR records
         self.cdr_records = {}
+        self.file_locations = {}
         for record in module_config:
             file_name = record['file']
+            cdr_dir = record.get('cdr-dir', 'cdr-csv')
+            self.file_locations[file_name] = cdr_dir
             ast_id = record.get('id') or 0
             if ast_id not in self.cdr_records:
                 self.cdr_records[ast_id] = {}
@@ -79,7 +82,8 @@
                 records = self.cdr_records[ast_id][file_name]
                 cdr_expect = AsteriskCSVCDR(records=records)
                 cdr_file = AsteriskCSVCDR(filename=ast_instance.get_path(
-                    "astlogdir", "cdr-csv", "%s.csv" % file_name))
+                    "astlogdir", self.file_locations[file_name],
+                    "%s.csv" % file_name))
                 if cdr_expect.match(cdr_file):
                     LOGGER.debug("%s.csv: CDR results met expectations" %
                                  file_name)

-- 
To view, visit https://gerrit.asterisk.org/1483
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8148499a447a27129ca6620effcfc3bf7b40a0d4
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Jonathan Rose <jrose at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Jonathan Rose <jrose at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list