[Asterisk-code-review] cdr: Add tests for ignore options. (testsuite[master])

Friendly Automation asteriskteam at digium.com
Mon Oct 10 12:14:06 CDT 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/testsuite/+/19401 )

Change subject: cdr: Add tests for ignore options.
......................................................................

cdr: Add tests for ignore options.

Adds tests for the ignorestatechanges
and ignoredialchanges options in cdr.conf.

ASTERISK-30091

Change-Id: Idbb65c8427284d13c8a8a08739d2eb5f3f8d36b6
---
A tests/cdr/cdr_manipulation/cdr_ignore_dial_changes/configs/ast1/cdr.conf
A tests/cdr/cdr_manipulation/cdr_ignore_dial_changes/configs/ast1/extensions.conf
A tests/cdr/cdr_manipulation/cdr_ignore_dial_changes/test-config.yaml
A tests/cdr/cdr_manipulation/cdr_ignore_state_changes/configs/ast1/cdr.conf
A tests/cdr/cdr_manipulation/cdr_ignore_state_changes/configs/ast1/extensions.conf
A tests/cdr/cdr_manipulation/cdr_ignore_state_changes/test-config.yaml
M tests/cdr/cdr_manipulation/tests.yaml
7 files changed, 161 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit




diff --git a/tests/cdr/cdr_manipulation/cdr_ignore_dial_changes/configs/ast1/cdr.conf b/tests/cdr/cdr_manipulation/cdr_ignore_dial_changes/configs/ast1/cdr.conf
new file mode 100644
index 0000000..28fba7c
--- /dev/null
+++ b/tests/cdr/cdr_manipulation/cdr_ignore_dial_changes/configs/ast1/cdr.conf
@@ -0,0 +1,10 @@
+[general]
+enable=yes
+debug=yes
+ignorestatechanges=yes
+ignoredialchanges=yes
+
+[csv]
+usegmtime=yes    ; log date/time in GMT.  Default is "no"
+loguniqueid=yes  ; log uniqueid.  Default is "no"
+loguserfield=yes ; log user field.  Default is "no"
diff --git a/tests/cdr/cdr_manipulation/cdr_ignore_dial_changes/configs/ast1/extensions.conf b/tests/cdr/cdr_manipulation/cdr_ignore_dial_changes/configs/ast1/extensions.conf
new file mode 100644
index 0000000..9e97338
--- /dev/null
+++ b/tests/cdr/cdr_manipulation/cdr_ignore_dial_changes/configs/ast1/extensions.conf
@@ -0,0 +1,21 @@
+[default]
+exten => echo,1,NoOp()
+	same => n,Set(CDR_PROP(disable)=1)
+	same => n,Answer()
+	same => n,Echo()
+exten => nodialchanges,1,NoOp()
+	same => n,Set(CDR_PROP(disable)=0)
+	same => n,Dial(Local/target at default/n,,g)
+	same => n,Dial(Local/valid at default/n,,g)
+	same => n,Dial(Local/valid at default/n,,g)
+	same => n,Hangup()
+exten => target,1,NoOp()
+	same => n,Set(CDR_PROP(disable)=1)
+	same => n,Answer()
+	same => n,Wait(0.1)
+	same => n,Hangup()
+exten => valid,1,NoOp()
+	same => n,Set(CDR_PROP(disable)=1)
+	same => n,Answer()
+	same => n,Wait(0.1)
+	same => n,Hangup()
diff --git a/tests/cdr/cdr_manipulation/cdr_ignore_dial_changes/test-config.yaml b/tests/cdr/cdr_manipulation/cdr_ignore_dial_changes/test-config.yaml
new file mode 100644
index 0000000..29abee0
--- /dev/null
+++ b/tests/cdr/cdr_manipulation/cdr_ignore_dial_changes/test-config.yaml
@@ -0,0 +1,46 @@
+testinfo:
+    summary: 'Test ignoredialchanges'
+    description: |
+        'This test makes sure that dial state changes
+        do not affect the CDR when the ignoredialchanges
+        option is set to yes.'
+
+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/nodialchanges at default'
+            context: 'default'
+            exten: 'echo'
+            priority: '1'
+
+cdr-config:
+    -
+        file: 'Master'
+        lines:
+            -
+                destination: 'nodialchanges'
+                dcontext: 'default'
+                channel: 'Local/nodialchanges at default-.*'
+                disposition: 'ANSWERED'
+                amaflags: 'DOCUMENTATION'
+
+properties:
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'app_echo'
+        - asterisk: 'app_dial'
+        - asterisk: 'func_cdr'
+    tags:
+        - CDR
+
diff --git a/tests/cdr/cdr_manipulation/cdr_ignore_state_changes/configs/ast1/cdr.conf b/tests/cdr/cdr_manipulation/cdr_ignore_state_changes/configs/ast1/cdr.conf
new file mode 100644
index 0000000..fdd1b80
--- /dev/null
+++ b/tests/cdr/cdr_manipulation/cdr_ignore_state_changes/configs/ast1/cdr.conf
@@ -0,0 +1,9 @@
+[general]
+enable=yes
+debug=yes
+ignorestatechanges=yes
+
+[csv]
+usegmtime=yes    ; log date/time in GMT.  Default is "no"
+loguniqueid=yes  ; log uniqueid.  Default is "no"
+loguserfield=yes ; log user field.  Default is "no"
diff --git a/tests/cdr/cdr_manipulation/cdr_ignore_state_changes/configs/ast1/extensions.conf b/tests/cdr/cdr_manipulation/cdr_ignore_state_changes/configs/ast1/extensions.conf
new file mode 100644
index 0000000..9369947
--- /dev/null
+++ b/tests/cdr/cdr_manipulation/cdr_ignore_state_changes/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[default]
+exten => echo,1,NoOp()
+	same => n,Set(CDR_PROP(disable)=1)
+	same => n,Answer()
+	same => n,Echo()
+exten => nostatechanges,1,NoOp()
+	same => n,Set(CDR_PROP(disable)=0)
+	same => n,Set(CONFBRIDGE(user,quiet)=yes) ; suppress prompts to speed up the test
+	same => n,Set(CONFBRIDGE(user,timeout)=1)
+	same => n,ConfBridge(test)
+	same => n,ConfBridge(test)
+	same => n,ConfBridge(test)
+	same => n,Hangup()
diff --git a/tests/cdr/cdr_manipulation/cdr_ignore_state_changes/test-config.yaml b/tests/cdr/cdr_manipulation/cdr_ignore_state_changes/test-config.yaml
new file mode 100644
index 0000000..fcd0752
--- /dev/null
+++ b/tests/cdr/cdr_manipulation/cdr_ignore_state_changes/test-config.yaml
@@ -0,0 +1,46 @@
+testinfo:
+    summary: 'Test ignorestatechanges'
+    description: |
+        'This test makes sure that bridging changes, such
+        as entering and leaving bridges like ConfBridge, do not affect the
+        CDR when the ignorestatechanges option is set to yes.'
+
+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/nostatechanges at default'
+            context: 'default'
+            exten: 'echo'
+            priority: '1'
+
+cdr-config:
+    -
+        file: 'Master'
+        lines:
+            -
+                destination: 'nostatechanges'
+                dcontext: 'default'
+                channel: 'Local/nostatechanges at default-.*'
+                disposition: 'ANSWERED'
+                amaflags: 'DOCUMENTATION'
+
+properties:
+    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 46a74bd..5e5bb0d 100644
--- a/tests/cdr/cdr_manipulation/tests.yaml
+++ b/tests/cdr/cdr_manipulation/tests.yaml
@@ -6,3 +6,5 @@
     - test: 'nocdr'
     - test: 'cdr_prop_disable'
     - test: 'func_cdr'
+    - test: 'cdr_ignore_state_changes'
+    - test: 'cdr_ignore_dial_changes'

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/19401
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Change-Id: Idbb65c8427284d13c8a8a08739d2eb5f3f8d36b6
Gerrit-Change-Number: 19401
Gerrit-PatchSet: 5
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221010/df6a2d28/attachment-0001.html>


More information about the asterisk-code-review mailing list