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

N A asteriskteam at digium.com
Fri Sep 30 19:06:53 CDT 2022


N A has uploaded this change for review. ( 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, 160 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/01/19401/1

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..c2008b2
--- /dev/null
+++ b/tests/cdr/cdr_manipulation/cdr_ignore_dial_changes/test-config.yaml
@@ -0,0 +1,45 @@
+testinfo:
+    summary: 'Test ignoredialchanges'
+    description: |
+        'This test makes sure that dial state changes
+        do not affect the 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/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..8ab2e9f
--- /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.'
+
+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: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221001/16748710/attachment-0001.html>


More information about the asterisk-code-review mailing list