[Asterisk-code-review] tests/channels/pjsip/statsd: Add a test for stats generated ... (testsuite[master])

Matt Jordan asteriskteam at digium.com
Wed Nov 18 21:28:59 CST 2015


Matt Jordan has uploaded a new change for review.

  https://gerrit.asterisk.org/1658

Change subject: tests/channels/pjsip/statsd: Add a test for stats generated for PJSIP contacts
......................................................................

tests/channels/pjsip/statsd: Add a test for stats generated for PJSIP contacts

This patch adds a test for StatsD statistics generated for PJSIP contacts.
The statistics include overall counts for PJSIP contact states, as well as for
the round-trip time calculated for a specific qualified PJSIP contact.

ASTERISK-25571

Change-Id: I32a0e82b698a36331a81f6c3ed269b8fd71ad20a
---
A tests/channels/pjsip/statsd/contacts/configs/ast1/pjsip.conf
A tests/channels/pjsip/statsd/contacts/configs/ast1/statsd.conf
A tests/channels/pjsip/statsd/contacts/sipp/options.xml
A tests/channels/pjsip/statsd/contacts/test-config.yaml
A tests/channels/pjsip/statsd/tests.yaml
M tests/channels/pjsip/tests.yaml
6 files changed, 91 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/58/1658/1

diff --git a/tests/channels/pjsip/statsd/contacts/configs/ast1/pjsip.conf b/tests/channels/pjsip/statsd/contacts/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..52e0162
--- /dev/null
+++ b/tests/channels/pjsip/statsd/contacts/configs/ast1/pjsip.conf
@@ -0,0 +1,14 @@
+[mytransport]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[sipp]
+type=endpoint
+aors=sipp
+
+[sipp]
+type=aor
+contact=sip:127.0.0.1:5061
+qualify_timeout=10
+qualify_frequency=5
diff --git a/tests/channels/pjsip/statsd/contacts/configs/ast1/statsd.conf b/tests/channels/pjsip/statsd/contacts/configs/ast1/statsd.conf
new file mode 100644
index 0000000..d8d5a4c
--- /dev/null
+++ b/tests/channels/pjsip/statsd/contacts/configs/ast1/statsd.conf
@@ -0,0 +1,3 @@
+[general]
+enabled = yes
+server = 127.0.0.1
\ No newline at end of file
diff --git a/tests/channels/pjsip/statsd/contacts/sipp/options.xml b/tests/channels/pjsip/statsd/contacts/sipp/options.xml
new file mode 100644
index 0000000..4a6daaa
--- /dev/null
+++ b/tests/channels/pjsip/statsd/contacts/sipp/options.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="UAS OPTIONS">
+    <recv request="OPTIONS"/>
+
+  <pause></pause>
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+    ]]>
+  </send>
+
+</scenario>
diff --git a/tests/channels/pjsip/statsd/contacts/test-config.yaml b/tests/channels/pjsip/statsd/contacts/test-config.yaml
new file mode 100644
index 0000000..d98382e
--- /dev/null
+++ b/tests/channels/pjsip/statsd/contacts/test-config.yaml
@@ -0,0 +1,46 @@
+testinfo:
+    summary: Verify StatsD statistics that are produced surrounding a PJSIP contact
+    description: |
+        This test verifies that a qualified contact will produced expected StatsD
+        statistics. This includes changing the overall count of contacts in
+        expected states, as well as the round-trip qualify time of the contact in
+        question.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            typename: 'mockd.MockDServer'
+            config-section: 'statsd-config'
+
+test-object-config:
+    fail-on-any: False
+    reactor-timeout: 10
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'options.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+statsd-config:
+    regex: True
+    packets:
+        -
+            'PJSIP\.contacts\.states\.Unknown:\+1\|g'
+        -
+            'PJSIP\.contacts\.states\.Unknown:\-1\|g'
+        -
+            'PJSIP\.contacts\.states\.Reachable:\+1\|g'
+        -
+            'PJSIP\.contacts\.sipp@@sip:127\.0\.0\.1:5061\.rtt:.*\|ms'
+
+properties:
+    minversion: '13.7.0'
+    dependencies:
+        - python: 'autobahn.websocket'
+        - python: 'starpy'
+        - python: 'twisted'
+    tags:
+        - statsd
+        - apps
diff --git a/tests/channels/pjsip/statsd/tests.yaml b/tests/channels/pjsip/statsd/tests.yaml
new file mode 100644
index 0000000..9ebd4d9
--- /dev/null
+++ b/tests/channels/pjsip/statsd/tests.yaml
@@ -0,0 +1,5 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'contacts'
+    - test: 'registrations'
+
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index 1941c54..e450574 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -16,6 +16,7 @@
     - dir: 'resolver'
     - dir: 'rtp'
     - dir: 'sdp_offer_answer'
+    - dir: 'statsd'
     - dir: 'subscriptions'
     - dir: 'transfers'
     - dir: 'video_calls'

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I32a0e82b698a36331a81f6c3ed269b8fd71ad20a
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list