[Asterisk-code-review] tests/channels/pjsip/statsd: Add a test for PJSIP registrati... (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/1659
Change subject: tests/channels/pjsip/statsd: Add a test for PJSIP registration stats
......................................................................
tests/channels/pjsip/statsd: Add a test for PJSIP registration stats
This patch adds a test for StatsD statistics generated for PJSIP outbound
registrations. This includes the overall number of outbound registrations,
as well as the overall count for particular outbound registration state.
ASTERISK-25571
Change-Id: I7a95597cd2c47d41552a18d6a43843fb2b7532f4
---
A tests/channels/pjsip/statsd/registrations/configs/ast1/pjsip.conf
A tests/channels/pjsip/statsd/registrations/configs/ast1/statsd.conf
A tests/channels/pjsip/statsd/registrations/sipp/register.xml
A tests/channels/pjsip/statsd/registrations/test-config.yaml
4 files changed, 104 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/59/1659/1
diff --git a/tests/channels/pjsip/statsd/registrations/configs/ast1/pjsip.conf b/tests/channels/pjsip/statsd/registrations/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..75fb697
--- /dev/null
+++ b/tests/channels/pjsip/statsd/registrations/configs/ast1/pjsip.conf
@@ -0,0 +1,18 @@
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1:5060
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[registrar-ipv4-udp]
+type=registration
+max_retries=1
+retry_interval=5
+forbidden_retry_interval=0
+client_uri=sip:ua-ipv4-udp at 127.0.0.1:5060\;transport=udp
+server_uri=sip:ua-ipv4-udp at 127.0.0.1:5061\;transport=udp
+expiration=300
+auth_rejection_permanent=yes
+contact_user=playback
+
diff --git a/tests/channels/pjsip/statsd/registrations/configs/ast1/statsd.conf b/tests/channels/pjsip/statsd/registrations/configs/ast1/statsd.conf
new file mode 100644
index 0000000..d8d5a4c
--- /dev/null
+++ b/tests/channels/pjsip/statsd/registrations/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/registrations/sipp/register.xml b/tests/channels/pjsip/statsd/registrations/sipp/register.xml
new file mode 100644
index 0000000..68f4164
--- /dev/null
+++ b/tests/channels/pjsip/statsd/registrations/sipp/register.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Accept a REGISTER request">
+
+ <!-- UA registers -->
+ <recv request="REGISTER">
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ [last_Expires:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ Content-Length: [len]
+
+ ]]>
+ </send>
+
+</scenario>
diff --git a/tests/channels/pjsip/statsd/registrations/test-config.yaml b/tests/channels/pjsip/statsd/registrations/test-config.yaml
new file mode 100644
index 0000000..8373c41
--- /dev/null
+++ b/tests/channels/pjsip/statsd/registrations/test-config.yaml
@@ -0,0 +1,57 @@
+testinfo:
+ summary: 'Test outbound registration StatsD statistics'
+ description: |
+ 'This test performs an outbound registration, and verifies that
+ the expected StatsD statistics are generated as a result.'
+
+properties:
+ minversion: '13.7.0'
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_outbound_registration'
+ - asterisk: 'res_statsd'
+ - sipp:
+ version: 'v3.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+ modules:
+ -
+ typename: 'mockd.MockDServer'
+ config-section: 'statsd-config'
+
+statsd-config:
+ # Note that we will never see the count get decremented, nor the
+ # last Unregistered state get decremented, as Asterisk sends an
+ # un-REGISTER on shutdown that we can't intercept. The processing
+ # of that un-REGISTER would trigger the previously mentioned
+ # counts.
+ packets:
+ -
+ 'PJSIP.registrations.count:+1|g'
+ -
+ 'PJSIP.registrations.state.Unregistered:+1|g'
+ -
+ 'PJSIP.registrations.state.Unregistered:-1|g'
+ -
+ 'PJSIP.registrations.state.Registered:+1|g'
+ -
+ 'PJSIP.registrations.state.Registered:-1|g'
+ -
+ 'PJSIP.registrations.state.Unregistered:+1|g'
+
+test-object-config:
+ fail-on-any: False
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'register.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+
--
To view, visit https://gerrit.asterisk.org/1659
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7a95597cd2c47d41552a18d6a43843fb2b7532f4
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