[Asterisk-code-review] Change in testsuite[master]: Add test for Local looping.

Mark Michelson (Code Review) asteriskteam at digium.com
Wed Apr 15 13:30:58 CDT 2015


Mark Michelson has uploaded a new change for review.

  https://gerrit.asterisk.org/118

Change subject: Add test for Local looping.
......................................................................

Add test for Local looping.

This test's goal is to ensure that calls to the dialplan
that result in a loop of local channels will be detected after
the prescribed number of max forwards and fail.

In this case, the max forwards is set to 10, so after 10 Dials,
the call should fail.

Change-Id: I1f44649ce16139091701c4c32efc23bd7b2e270e
---
A tests/channels/local/local_loop/configs/ast1/extensions.conf
A tests/channels/local/local_loop/test-config.yaml
M tests/channels/local/tests.yaml
3 files changed, 69 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/18/118/1

diff --git a/tests/channels/local/local_loop/configs/ast1/extensions.conf b/tests/channels/local/local_loop/configs/ast1/extensions.conf
new file mode 100644
index 0000000..09016d6
--- /dev/null
+++ b/tests/channels/local/local_loop/configs/ast1/extensions.conf
@@ -0,0 +1,10 @@
+[default]
+
+exten => loop,1,NoOp()
+same => n,Set(CHANNEL(max_forwards)=10)
+same => n,NoOp(max forwards is ${CHANNEL(max_forwards)})
+same => n,Goto(default,loop1,1)
+
+exten => loop1,1,NoOp()
+same => n,NoOp(max forwards is ${CHANNEL(max_forwards)})
+same => n,Dial(Local/loop1 at default)
diff --git a/tests/channels/local/local_loop/test-config.yaml b/tests/channels/local/local_loop/test-config.yaml
new file mode 100644
index 0000000..8a163db
--- /dev/null
+++ b/tests/channels/local/local_loop/test-config.yaml
@@ -0,0 +1,58 @@
+testinfo:
+    summary: 'Ensure that infinite loops of Local channels cannot happen.'
+    description: |
+        'This test originates a call to a Local extension, which sets the max
+        forwards for the call to 10. The extension then goes to an extension which
+        dials itself. The test ensures that after 10 Dials, all of the calls are
+        hung up.'
+
+test-modules:
+    test-object:
+        typename: test_case.TestCaseModule
+        config-section: test-config
+    modules:
+        -
+            config-section: originator-config
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: ami-config
+            typename: 'ami.AMIEventModule'
+        -
+            config-section: hangup-config
+            typename: 'pluggable_modules.HangupMonitor'
+
+test-config:
+    connect-ami: True
+
+originator-config:
+    channel: 'Local/loop at default'
+    application: 'Echo'
+    ignore-originate-failure: 'yes'
+    trigger: 'ami_connect'
+
+ami-config:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialBegin'
+                DestChannel: 'Local/loop1 at default.*'
+        count: 10
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialEnd'
+                DestChannel: 'Local/loop1 at default.*'
+        count: 10
+
+hangup-config:
+    ids: ['0']
+
+properties:
+    minversion: '13.0.0'
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+    tags:
+        - chan_local
diff --git a/tests/channels/local/tests.yaml b/tests/channels/local/tests.yaml
index 64ac74a..a009b04 100644
--- a/tests/channels/local/tests.yaml
+++ b/tests/channels/local/tests.yaml
@@ -4,3 +4,4 @@
     - test: 'local_call'
     - test: 'local_holding_bridge'
     - test: 'local_optimize_away'
+    - test: 'local_loop'

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f44649ce16139091701c4c32efc23bd7b2e270e
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list