[Asterisk-code-review] tests/remote-test: Add a sample remote test (testsuite[master])

Anonymous Coward asteriskteam at digium.com
Mon Nov 23 06:31:35 CST 2015


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: tests/remote-test: Add a sample remote test
......................................................................


tests/remote-test: Add a sample remote test

This patch adds a test that only executes if the Test Suite is in 'remote'
mode. It will attempt to connect to a remote Asterisk instance, and spawn a
Local channel at s at default. If the channel is answered, the test will pass.

This test is provided merely as an example of how to write a remote test.

Change-Id: I857c5f20d4c260be73697062506f63cb3533c3a8
---
A tests/remote-test/test-config.yaml
M tests/tests.yaml
2 files changed, 70 insertions(+), 1 deletion(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/tests/remote-test/test-config.yaml b/tests/remote-test/test-config.yaml
new file mode 100644
index 0000000..811a954
--- /dev/null
+++ b/tests/remote-test/test-config.yaml
@@ -0,0 +1,69 @@
+testinfo:
+    summary:     'A remote test demo'
+    description: |
+        This test is simply a demonstration of a remote Asterisk test. Rather
+        than spawn a local instance of Asterisk, it will attempt to connect
+        back to some Asterisk instance running on a remote system.
+
+        You will need to configure the global test-config.yaml file for this
+        test to function properly. In addition to providing credentials for the
+        SSH connection, an AMI connection should be configured for the remote
+        Asterisk instance.
+
+        The test spawns a Local channel at s at default. So long as the channel
+        is created and answered, the test will pass.
+
+test-modules:
+    test-object:
+        config-section: test-config
+        typename: test_case.TestCaseModule
+    modules:
+        -
+            config-section: originator-config
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: hangup-monitor
+            typename: 'pluggable_modules.HangupMonitor'
+        -
+            config-section: ami-config
+            typename: 'ami.AMIEventModule'
+
+test-config:
+    connect-ami: True
+
+# This section defines the expected dialplan on the remote system.
+# At this time, nothing reads this configuration; however, it can
+# be used as the basis for what should exist.
+dialplan:
+    default:
+        s:
+            - Answer()
+            - Hangup()
+
+
+originator-config:
+    trigger: 'ami_connect'
+    id: '0'
+    channel: 'Local/s at default'
+    application: 'Echo'
+    async: True
+
+hangup-monitor:
+    ids: ['0']
+
+ami-config:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'Hangup'
+        requirements:
+            match:
+                Channel: 'Local/s at default-.*'
+        count: '>1'
+
+properties:
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - custom : 'remote'
diff --git a/tests/tests.yaml b/tests/tests.yaml
index 1a92254..a94bc94 100644
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -34,4 +34,4 @@
     - dir: 'realtime'
     - dir: 'http_server'
     - dir: 'sorcery'
-
+    - test: 'remote-test'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I857c5f20d4c260be73697062506f63cb3533c3a8
Gerrit-PatchSet: 4
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list