[Asterisk-code-review] tests/cdr/cdr manipulation: Add a test for CDR PROP's disabl... (testsuite[master])

Mark Michelson asteriskteam at digium.com
Mon Jun 15 16:36:25 CDT 2015


Mark Michelson has submitted this change and it was merged.

Change subject: tests/cdr/cdr_manipulation: Add a test for CDR_PROP's disable attribute
......................................................................


tests/cdr/cdr_manipulation: Add a test for CDR_PROP's disable attribute

This patch adds a test for the CDR_PROP's disable attribute. It tests
that the function will disable CDRs in a variety of scenarios,
including:
* A single channel executing dialplan (in this case, one half of every
  Local channel created)
* A single channel Dial operation. Both sides are prevented from
  creating a CDR.
* A parallel dial of multiple channels. All channels are prevented from
  generating CDRs.
* A disabling of CDRs, followed by re-enabling the CDRs. The first
  expected CDR in the chain is disabled; the second expected CDR is
  enabled.

ASTERISK-24344

Change-Id: If43847b74d6eee5f454828fc35aa45e7aa870e18
---
A tests/cdr/cdr_manipulation/cdr_prop_disable/configs/ast1/extensions.conf
A tests/cdr/cdr_manipulation/cdr_prop_disable/test-config.yaml
M tests/cdr/cdr_manipulation/tests.yaml
3 files changed, 102 insertions(+), 0 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, approved; Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/tests/cdr/cdr_manipulation/cdr_prop_disable/configs/ast1/extensions.conf b/tests/cdr/cdr_manipulation/cdr_prop_disable/configs/ast1/extensions.conf
new file mode 100644
index 0000000..c354c55
--- /dev/null
+++ b/tests/cdr/cdr_manipulation/cdr_prop_disable/configs/ast1/extensions.conf
@@ -0,0 +1,35 @@
+[default]
+
+exten => echo,1,NoOp()
+ same => n,Set(CDR_PROP(disable)=True)
+ same => n,Answer()
+ same => n,Echo()
+
+exten => single,1,NoOp()
+ same => n,Set(CDR_PROP(disable)=True)
+ same => n,Dial(Local/target at default/n)
+ same => n,Hangup()
+
+exten => multiple,1,NoOp()
+ same => n,Set(CDR_PROP(disable)=True)
+ same => n,Dial(Local/target at default/n&Local/target at default/n&Local/target at default/n)
+ same => n,Hangup()
+
+exten => reenable,1,NoOp()
+ same => n,Set(CDR_PROP(disable)=True)
+ same => n,Dial(Local/target at default/n,,g)
+ same => n,Set(CDR_PROP(disable)=False)
+ same => n,Dial(Local/valid at default/n)
+ same => n,Hangup()
+
+
+exten => target,1,NoOp()
+ same => n,Set(CDR_PROP(disable)=True)
+ same => n,Answer()
+ same => n,Hangup()
+
+exten => valid,1,NoOp()
+ same => n,Set(CDR_PROP(disable)=True)
+ same => n,Answer()
+ same => n,Hangup()
+
diff --git a/tests/cdr/cdr_manipulation/cdr_prop_disable/test-config.yaml b/tests/cdr/cdr_manipulation/cdr_prop_disable/test-config.yaml
new file mode 100644
index 0000000..ae404a6
--- /dev/null
+++ b/tests/cdr/cdr_manipulation/cdr_prop_disable/test-config.yaml
@@ -0,0 +1,65 @@
+testinfo:
+    summary: 'Test the CDR_PROP function "disable" attribute'
+    description: |
+        'This test verifies that the CDR_PROP function can disable CDRs under
+        a variety of conditions. This includes:
+
+        1. A simple Dial of a single channel. No CDR is expected.
+        2. A parallel Dial of multiple channels. No CDRs for any of the
+           channels are expected.
+        3. A re-enabling of CDRs. The first Dial operation should produce
+           no CDRs. The "g" flag is used to continue dialplan execution,
+           which includes re-enabling CDRs. The second Dial operation should
+           produce a single CDR.'
+
+test-modules:
+    test-object:
+        config-section: 'test-object-config'
+        typename: 'test_case.SimpleTestCase'
+    modules:
+        -
+            config-section: 'cdr-config'
+            typename: 'cdr.CDRModule'
+
+test-object-config:
+    spawn-after-hangup: True
+    test-iterations:
+        -
+            channel: 'Local/single at default'
+            context: 'default'
+            exten: 'echo'
+            priority: '1'
+        -
+            channel: 'Local/multiple at default'
+            context: 'default'
+            exten: 'echo'
+            priority: '1'
+        -
+            channel: 'Local/reenable at default'
+            context: 'default'
+            exten: 'echo'
+            priority: '1'
+
+cdr-config:
+    -
+        file: 'Master'
+        lines:
+            -
+                destination: 'reenable'
+                dcontext: 'default'
+                channel: 'Local/reenable at default-.*'
+                dchannel: 'Local/valid at default-.*'
+                disposition: 'ANSWERED'
+                amaflags: 'DOCUMENTATION'
+
+properties:
+    minversion: '13.5.0'
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'app_echo'
+        - asterisk: 'app_dial'
+        - asterisk: 'func_cdr'
+    tags:
+        - CDR
+
diff --git a/tests/cdr/cdr_manipulation/tests.yaml b/tests/cdr/cdr_manipulation/tests.yaml
index 13eddb6..1da5f1d 100644
--- a/tests/cdr/cdr_manipulation/tests.yaml
+++ b/tests/cdr/cdr_manipulation/tests.yaml
@@ -4,3 +4,5 @@
     - test: 'console_fork_before_dial'
     - test: 'cdr_fork_end_time'
     - test: 'nocdr'
+    - test: 'cdr_prop_disable'
+

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If43847b74d6eee5f454828fc35aa45e7aa870e18
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list