[asterisk-commits] ConfBridge: Add user timeout test. (testsuite[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Nov 19 10:14:28 CST 2015
Anonymous Coward #1000019 has submitted this change and it was merged.
Change subject: ConfBridge: Add user timeout test.
......................................................................
ConfBridge: Add user timeout test.
This adds a test that ensures that the user timeout options for
ConfBridge work as expected. It tests both the configured value in
confbridge.conf as well as the CONFBRIDGE dialplan function.
Change-Id: Ib4d32da391cc9f3a2e85929530b908fa95258238
---
A tests/apps/confbridge/confbridge_timeout/configs/ast1/confbridge.conf
A tests/apps/confbridge/confbridge_timeout/configs/ast1/extensions.conf
A tests/apps/confbridge/confbridge_timeout/test-config.yaml
M tests/apps/confbridge/tests.yaml
4 files changed, 110 insertions(+), 1 deletion(-)
Approvals:
Anonymous Coward #1000019: Verified
Matt Jordan: Looks good to me, approved
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/tests/apps/confbridge/confbridge_timeout/configs/ast1/confbridge.conf b/tests/apps/confbridge/confbridge_timeout/configs/ast1/confbridge.conf
new file mode 100644
index 0000000..e0b2566
--- /dev/null
+++ b/tests/apps/confbridge/confbridge_timeout/configs/ast1/confbridge.conf
@@ -0,0 +1,12 @@
+[default_user]
+type=user
+timeout=10
+;The timeout does not start counting until the participant joins the underlying
+;bridge in the ConfBridge application. This happens after announcing that the
+;participant is the only person in the conference. So that our timing can be
+;more accurate, we turn off announce_only_user so that our attempt to time the
+;user's stay in the ConfBridge is not skewed.
+announce_only_user=no
+
+[default_bridge]
+type=bridge
diff --git a/tests/apps/confbridge/confbridge_timeout/configs/ast1/extensions.conf b/tests/apps/confbridge/confbridge_timeout/configs/ast1/extensions.conf
new file mode 100644
index 0000000..ce2c516
--- /dev/null
+++ b/tests/apps/confbridge/confbridge_timeout/configs/ast1/extensions.conf
@@ -0,0 +1,29 @@
+[default]
+exten => alice,1,NoOp()
+same => n,Goto(default,common,1)
+
+exten => bob,1,NoOp()
+same => n,Set(CONFBRIDGE(user,timeout)=5)
+same => n,Goto(default,common,1)
+
+exten => common,1,NoOp()
+same => n,Answer()
+same => n,Set(BEFORE=${EPOCH})
+same => n,ConfBridge(foo)
+same => n,Set(AFTER=${EPOCH})
+same => n,Set(INTERVAL=$[${AFTER} - ${BEFORE}])
+same => n,GotoIf($[${CONFBRIDGE_RESULT} != TIMEOUT]?Fail1)
+same => n,Set(TOLERANCE=$[${CONFBRIDGE(user,timeout)} + 2])
+same => n,GotoIf($[${INTERVAL} > ${TOLERANCE}]?Fail2)
+same => n,UserEvent(ConfBridgeTimeout,Result: Pass)
+same => n,Goto(hangup)
+
+; CONFBRIDGE_RESULT set to something other than TIMEOUT
+same => n(Fail1),UserEvent(ConfBridgeTimeout,Result: Fail,Reason: ${CONFBRIDGE_RESULT})
+same => n,Goto(hangup)
+
+; ConfBridge timed out at unexpected time
+same => n(Fail2),UserEvent(ConfBridgeTimeout,Result: Fail,Reason: ${INTERVAL})
+same => n,Goto(hangup)
+
+same => n(hangup),Hangup()
diff --git a/tests/apps/confbridge/confbridge_timeout/test-config.yaml b/tests/apps/confbridge/confbridge_timeout/test-config.yaml
new file mode 100644
index 0000000..08010be
--- /dev/null
+++ b/tests/apps/confbridge/confbridge_timeout/test-config.yaml
@@ -0,0 +1,68 @@
+testinfo:
+ summary: 'Ensure that Confbridge user timeouts work as expected'
+ description: |
+ 'This test configures a ConfBridge user profile that has a timeout of 10 seconds.
+ Alice calls into the ConfBridge. We expect that she will be removed from the
+ ConfBridge after 10 seconds.
+ Bob first calls into the CONFBRIDGE dialplan function to set his timeout to 5 seconds.
+ We expect that he will be removed from the ConfBridge after 5 seconds.
+ We ensure that both Bob and Alice have their CONFBRIDGE_RESULT channel variable set
+ to "TIMEOUT" when they are removed from the ConfBridge.'
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'test_case.TestCaseModule'
+ modules:
+ -
+ config-section: alice-originator
+ typename: 'pluggable_modules.Originator'
+ -
+ config-section: bob-originator
+ typename: 'pluggable_modules.Originator'
+ -
+ config-section: hangup-monitor
+ typename: 'pluggable_modules.HangupMonitor'
+ -
+ config-section: ami-config
+ typename: 'ami.AMIEventModule'
+
+test-object-config:
+ connect-ami: True
+
+alice-originator:
+ channel: 'Local/alice at default'
+ application: 'Echo'
+ trigger: 'ami_connect'
+
+bob-originator:
+ channel: 'Local/bob at default'
+ application: 'Echo'
+ trigger: 'ami_connect'
+
+hangup-monitor:
+ ids: '0'
+
+ami-config:
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'UserEvent'
+ UserEvent: 'ConfBridgeTimeout'
+ requirements:
+ match:
+ Result: 'Pass'
+ count: 2
+
+
+properties:
+ minversion: '13.7.0'
+ tags:
+ - confbridge
+ - apps
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_confbridge'
+ - asterisk: 'app_userevent'
diff --git a/tests/apps/confbridge/tests.yaml b/tests/apps/confbridge/tests.yaml
index dd91008..aebe64c 100644
--- a/tests/apps/confbridge/tests.yaml
+++ b/tests/apps/confbridge/tests.yaml
@@ -13,4 +13,4 @@
- test: 'confbridge_result'
- test: 'confbridge_triple_lindy'
- test: 'confbridge_end_marked'
-
+ - test: 'confbridge_timeout'
--
To view, visit https://gerrit.asterisk.org/1628
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib4d32da391cc9f3a2e85929530b908fa95258238
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
More information about the asterisk-commits
mailing list