[Asterisk-code-review] app_signal: Add tests for Signal and WaitForSignal (testsuite[20])

Friendly Automation asteriskteam at digium.com
Tue Jan 31 09:48:19 CST 2023


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

Change subject: app_signal: Add tests for Signal and WaitForSignal
......................................................................

app_signal: Add tests for Signal and WaitForSignal

Adds tests for the Signal and WaitForSignal
applications to ensure proper functionality.

ASTERISK-29810

Change-Id: I314a7f704def5ecf2e4eac008aebfdc3077d08cd
---
A tests/apps/signal/configs/ast1/extensions.conf
A tests/apps/signal/test-config.yaml
M tests/apps/tests.yaml
3 files changed, 108 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit




diff --git a/tests/apps/signal/configs/ast1/extensions.conf b/tests/apps/signal/configs/ast1/extensions.conf
new file mode 100644
index 0000000..c152104
--- /dev/null
+++ b/tests/apps/signal/configs/ast1/extensions.conf
@@ -0,0 +1,32 @@
+
+[default]
+exten => s,1,Answer()
+	same => n,Signal(nothing)
+	same => n,GotoIf($["${SIGNALSTATUS}"!="FAILURE"]?fail,1)
+	same => n,Dial(Local/s at spawn-hangup,5)
+	same => n,GotoIf($["${DIALSTATUS}"="TIMEOUT"]?fail,1)
+	same => n,Originate(Local/1 at spawn,app,Wait,5,,4)
+	same => n,Wait(1.${RAND(5,9)})
+	same => n,Signal(testsig1,payload1)
+	same => n,GotoIf($["${SIGNALSTATUS}"!="SUCCESS"]?fail,1)
+	same => n,Originate(Local/2 at spawn,app,Wait,5,,4)
+	same => n,Originate(Local/2 at spawn,app,Wait,5,,4)
+	same => n,Wait(1.${RAND(5,9)})
+	same => n,Signal(testsig2,payload2)
+	same => n,Hangup()
+
+[spawn-hangup]
+exten => s,1,WaitForSignal(mysignal,2)
+	same => n,Hangup()
+
+[spawn]
+exten => _[12],1,Answer()
+	same => n,WaitForSignal(testsig${EXTEN})
+	same => n,UserEvent(SignalSuccess,Result: ${IF($["${WAITFORSIGNALSTATUS}"="SIGNALED"]?Pass:Failure)})
+	same => n,ExecIf($["${WAITFORSIGNALPAYLOAD}"!="payload${EXTEN}"]?UserEvent(SignalSuccess,Result:Failure))
+	same => n,Hangup()
+
+[nothing]
+exten => 0,1,Answer()
+	same => n,Wait(10)
+	same => n,Hangup()
diff --git a/tests/apps/signal/test-config.yaml b/tests/apps/signal/test-config.yaml
new file mode 100644
index 0000000..675d76b
--- /dev/null
+++ b/tests/apps/signal/test-config.yaml
@@ -0,0 +1,61 @@
+testinfo:
+    summary: 'Ensure that app_signal functions correctly.'
+    description: |
+        'This tests the Signal and WaitForSignal applications to make sure
+        that signaling works correctly. This includes sending signals when
+        there are listeners as well as when there aren't any listeners, as
+        well as sending optional payloads.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'test_case.TestCaseModule'
+    modules:
+        -
+            config-section: caller-originator
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: hangup-monitor
+            typename: 'pluggable_modules.HangupMonitor'
+        -
+            config-section: ami-config
+            typename: 'pluggable_modules.EventActionModule'
+
+test-object-config:
+    connect-ami: True
+
+caller-originator:
+    channel: 'Local/s at default'
+    context: 'nothing'
+    exten: '0'
+    priority: '1'
+    trigger: 'ami_connect'
+
+hangup-monitor:
+    ids: '0'
+
+ami-config:
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    UserEvent: 'SignalSuccess'
+            requirements:
+                match:
+                    Result: 'Pass'
+            count: 3
+        stop_test:
+
+properties:
+    tags:
+        - dial
+        - apps
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'app_dial'
+        - asterisk: 'app_userevent'
+        - asterisk: 'app_originate'
+        - asterisk: 'app_signal'
+        - asterisk: 'pbx_config'
diff --git a/tests/apps/tests.yaml b/tests/apps/tests.yaml
index f74ba8e..8ce8fac 100644
--- a/tests/apps/tests.yaml
+++ b/tests/apps/tests.yaml
@@ -30,3 +30,4 @@
     - test: 'sf'
     - test: 'read'
     - test: 'if'
+    - test: 'signal'

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

Gerrit-Project: testsuite
Gerrit-Branch: 20
Gerrit-Change-Id: I314a7f704def5ecf2e4eac008aebfdc3077d08cd
Gerrit-Change-Number: 19875
Gerrit-PatchSet: 1
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230131/b14bb23f/attachment-0001.html>


More information about the asterisk-code-review mailing list