[Asterisk-code-review] tests/channels/pjsip/publish: Fix presence/dialog-info+xml t... (testsuite[master])

Joshua Colp asteriskteam at digium.com
Mon May 23 19:08:05 CDT 2016


Joshua Colp has uploaded a new change for review.

  https://gerrit.asterisk.org/2897

Change subject: tests/channels/pjsip/publish: Fix presence/dialog-info+xml tests.
......................................................................

tests/channels/pjsip/publish: Fix presence/dialog-info+xml tests.

These tests when run on Jenkins exposed some race conditions
and behavior differences in how they run. Initially a PUBLISH
message was duplicated at the start but now with the latest code
no longer occurs. Secondly it was possible for in between extension
states to get skipped if changes happened quickly.

To fix this the first message has been removed from each SIPp
scenario file. Secondly waits have been added to each custom device
state change to ensure they are processed before moving on.

Change-Id: Ie12bc27e1f0f3df6204c4e92acb2e93096c067a4
---
M tests/channels/pjsip/publish/dialog_info_xml/configs/ast1/extensions.conf
M tests/channels/pjsip/publish/dialog_info_xml/sipp/publish.xml
M tests/channels/pjsip/publish/presence_pidf/configs/ast1/extensions.conf
M tests/channels/pjsip/publish/presence_pidf/sipp/publish.xml
M tests/channels/pjsip/publish/presence_xpidf/configs/ast1/extensions.conf
M tests/channels/pjsip/publish/presence_xpidf/sipp/publish.xml
6 files changed, 29 insertions(+), 112 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/97/2897/1

diff --git a/tests/channels/pjsip/publish/dialog_info_xml/configs/ast1/extensions.conf b/tests/channels/pjsip/publish/dialog_info_xml/configs/ast1/extensions.conf
index 5354079..56eded4 100644
--- a/tests/channels/pjsip/publish/dialog_info_xml/configs/ast1/extensions.conf
+++ b/tests/channels/pjsip/publish/dialog_info_xml/configs/ast1/extensions.conf
@@ -2,9 +2,13 @@
 exten => presence,hint,Custom:presence
 
 exten => change_state,1,Set(DEVICE_STATE(Custom:presence)=NOT_INUSE)
+	same => n,Wait(1)
 	same => n,Set(DEVICE_STATE(Custom:presence)=RINGING)
+	same => n,Wait(1)
 	same => n,Set(DEVICE_STATE(Custom:presence)=INUSE)
+	same => n,Wait(1)
 	same => n,Set(DEVICE_STATE(Custom:presence)=ONHOLD)
+	same => n,Wait(1)
 
 exten => dummy,1,Answer
 	same => n,Echo
diff --git a/tests/channels/pjsip/publish/dialog_info_xml/sipp/publish.xml b/tests/channels/pjsip/publish/dialog_info_xml/sipp/publish.xml
index e3d90db..463bbdb 100644
--- a/tests/channels/pjsip/publish/dialog_info_xml/sipp/publish.xml
+++ b/tests/channels/pjsip/publish/dialog_info_xml/sipp/publish.xml
@@ -34,8 +34,8 @@
     <action>
       <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
 <dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"1\" state=\"full\" entity=\"sip:presence at 127.0.0.1:5061\">
- <dialog id=\"presence\">
-  <state>terminated</state>
+ <dialog id=\"presence\" direction=\"recipient\">
+  <state>early</state>
  </dialog>
 </dialog-info>" check_it="true" search_in="body" assign_to="presence2" />
     </action>
@@ -62,8 +62,8 @@
     <action>
       <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
 <dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"2\" state=\"full\" entity=\"sip:presence at 127.0.0.1:5061\">
- <dialog id=\"presence\" direction=\"recipient\">
-  <state>early</state>
+ <dialog id=\"presence\">
+  <state>confirmed</state>
  </dialog>
 </dialog-info>" check_it="true" search_in="body" assign_to="presence3" />
     </action>
@@ -92,45 +92,17 @@
 <dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"3\" state=\"full\" entity=\"sip:presence at 127.0.0.1:5061\">
  <dialog id=\"presence\">
   <state>confirmed</state>
- </dialog>
-</dialog-info>" check_it="true" search_in="body" assign_to="presence4" />
-    </action>
-  </recv>
-
-  <Reference variables="presence4" />
-
-  <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>
-
-  <recv request="PUBLISH" crlf="true">
-    <action>
-      <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
-<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"4\" state=\"full\" entity=\"sip:presence at 127.0.0.1:5061\">
- <dialog id=\"presence\">
-  <state>confirmed</state>
   <local>
    <target uri=\"sip:presence at 127.0.0.1:5061\">
     <param pname=\"\+sip.rendering\" pvalue=\"no\" />
    </target>
   </local>
  </dialog>
-</dialog-info>" check_it="true" search_in="body" assign_to="presence5" />
+</dialog-info>" check_it="true" search_in="body" assign_to="presence4" />
     </action>
   </recv>
 
-  <Reference variables="presence5" />
+  <Reference variables="presence4" />
 
   <send>
     <![CDATA[
diff --git a/tests/channels/pjsip/publish/presence_pidf/configs/ast1/extensions.conf b/tests/channels/pjsip/publish/presence_pidf/configs/ast1/extensions.conf
index 5354079..56eded4 100644
--- a/tests/channels/pjsip/publish/presence_pidf/configs/ast1/extensions.conf
+++ b/tests/channels/pjsip/publish/presence_pidf/configs/ast1/extensions.conf
@@ -2,9 +2,13 @@
 exten => presence,hint,Custom:presence
 
 exten => change_state,1,Set(DEVICE_STATE(Custom:presence)=NOT_INUSE)
+	same => n,Wait(1)
 	same => n,Set(DEVICE_STATE(Custom:presence)=RINGING)
+	same => n,Wait(1)
 	same => n,Set(DEVICE_STATE(Custom:presence)=INUSE)
+	same => n,Wait(1)
 	same => n,Set(DEVICE_STATE(Custom:presence)=ONHOLD)
+	same => n,Wait(1)
 
 exten => dummy,1,Answer
 	same => n,Echo
diff --git a/tests/channels/pjsip/publish/presence_pidf/sipp/publish.xml b/tests/channels/pjsip/publish/presence_pidf/sipp/publish.xml
index 84b34e9..4276d6c 100644
--- a/tests/channels/pjsip/publish/presence_pidf/sipp/publish.xml
+++ b/tests/channels/pjsip/publish/presence_pidf/sipp/publish.xml
@@ -41,15 +41,17 @@
     <action>
       <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
 <presence entity=\"sip:presence at 127.0.0.1:5061\" xmlns=\"urn:ietf:params:xml:ns:pidf\" xmlns:pp=\"urn:ietf:params:xml:ns:pidf:person\" xmlns:es=\"urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status\" xmlns:ep=\"urn:ietf:params:xml:ns:pidf:rpid:rpid-person\">
- <note>Ready</note>
+ <note>Ringing</note>
  <tuple id=\"presence\">
   <status>
-   <basic>open</basic>
+   <basic>closed</basic>
   </status>
   <contact priority=\"1\">sip:presence at 127.0.0.1:5061</contact>
  </tuple>
  <pp:person>
-  <status />
+  <status>
+   <ep:activities>ep:busy</ep:activities>
+  </status>
  </pp:person>
 </presence>" check_it="true" search_in="body" assign_to="presence2" />
     </action>
@@ -76,7 +78,7 @@
     <action>
       <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
 <presence entity=\"sip:presence at 127.0.0.1:5061\" xmlns=\"urn:ietf:params:xml:ns:pidf\" xmlns:pp=\"urn:ietf:params:xml:ns:pidf:person\" xmlns:es=\"urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status\" xmlns:ep=\"urn:ietf:params:xml:ns:pidf:rpid:rpid-person\">
- <note>Ringing</note>
+ <note>On the phone</note>
  <tuple id=\"presence\">
   <status>
    <basic>closed</basic>
@@ -113,7 +115,7 @@
     <action>
       <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
 <presence entity=\"sip:presence at 127.0.0.1:5061\" xmlns=\"urn:ietf:params:xml:ns:pidf\" xmlns:pp=\"urn:ietf:params:xml:ns:pidf:person\" xmlns:es=\"urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status\" xmlns:ep=\"urn:ietf:params:xml:ns:pidf:rpid:rpid-person\">
- <note>On the phone</note>
+ <note>On hold</note>
  <tuple id=\"presence\">
   <status>
    <basic>closed</basic>
@@ -130,43 +132,6 @@
   </recv>
 
   <Reference variables="presence4" />
-
-  <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>
-
-  <recv request="PUBLISH" crlf="true">
-    <action>
-      <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
-<presence entity=\"sip:presence at 127.0.0.1:5061\" xmlns=\"urn:ietf:params:xml:ns:pidf\" xmlns:pp=\"urn:ietf:params:xml:ns:pidf:person\" xmlns:es=\"urn:ietf:params:xml:ns:pidf:rpid:status:rpid-status\" xmlns:ep=\"urn:ietf:params:xml:ns:pidf:rpid:rpid-person\">
- <note>On hold</note>
- <tuple id=\"presence\">
-  <status>
-   <basic>closed</basic>
-  </status>
-  <contact priority=\"1\">sip:presence at 127.0.0.1:5061</contact>
- </tuple>
- <pp:person>
-  <status>
-   <ep:activities>ep:busy</ep:activities>
-  </status>
- </pp:person>
-</presence>" check_it="true" search_in="body" assign_to="presence5" />
-    </action>
-  </recv>
-
-  <Reference variables="presence5" />
 
   <send>
     <![CDATA[
diff --git a/tests/channels/pjsip/publish/presence_xpidf/configs/ast1/extensions.conf b/tests/channels/pjsip/publish/presence_xpidf/configs/ast1/extensions.conf
index 5354079..56eded4 100644
--- a/tests/channels/pjsip/publish/presence_xpidf/configs/ast1/extensions.conf
+++ b/tests/channels/pjsip/publish/presence_xpidf/configs/ast1/extensions.conf
@@ -2,9 +2,13 @@
 exten => presence,hint,Custom:presence
 
 exten => change_state,1,Set(DEVICE_STATE(Custom:presence)=NOT_INUSE)
+	same => n,Wait(1)
 	same => n,Set(DEVICE_STATE(Custom:presence)=RINGING)
+	same => n,Wait(1)
 	same => n,Set(DEVICE_STATE(Custom:presence)=INUSE)
+	same => n,Wait(1)
 	same => n,Set(DEVICE_STATE(Custom:presence)=ONHOLD)
+	same => n,Wait(1)
 
 exten => dummy,1,Answer
 	same => n,Echo
diff --git a/tests/channels/pjsip/publish/presence_xpidf/sipp/publish.xml b/tests/channels/pjsip/publish/presence_xpidf/sipp/publish.xml
index 07cf6c4..d726331 100644
--- a/tests/channels/pjsip/publish/presence_xpidf/sipp/publish.xml
+++ b/tests/channels/pjsip/publish/presence_xpidf/sipp/publish.xml
@@ -41,8 +41,8 @@
  <presentity uri=\"sip:presence at 127.0.0.1:5061;method=SUBSCRIBE\" />
  <atom atomid=(.*?) id=\"presence\">
   <address uri=\"sip:presence at 127.0.0.1:5061;user=ip\" priority=\"0.80000\">
-   <status status=\"open\" />
-   <msnsubstatus substatus=\"online\" />
+   <status status=\"inuse\" />
+   <msnsubstatus substatus=\"onthephone\" />
   </address>
  </atom>
 </presence>" check_it="true" search_in="body" assign_to="presence2" />
@@ -105,8 +105,8 @@
  <presentity uri=\"sip:presence at 127.0.0.1:5061;method=SUBSCRIBE\" />
  <atom atomid=(.*?) id=\"presence\">
   <address uri=\"sip:presence at 127.0.0.1:5061;user=ip\" priority=\"0.80000\">
-   <status status=\"inuse\" />
-   <msnsubstatus substatus=\"onthephone\" />
+   <status status=\"closed\" />
+   <msnsubstatus substatus=\"offline\" />
   </address>
  </atom>
 </presence>" check_it="true" search_in="body" assign_to="presence4" />
@@ -114,38 +114,6 @@
   </recv>
 
   <Reference variables="presence4" />
-
-  <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>
-
-  <recv request="PUBLISH" crlf="true">
-    <action>
-      <ereg regexp="<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>
-<presence>
- <presentity uri=\"sip:presence at 127.0.0.1:5061;method=SUBSCRIBE\" />
- <atom atomid=(.*?) id=\"presence\">
-  <address uri=\"sip:presence at 127.0.0.1:5061;user=ip\" priority=\"0.80000\">
-   <status status=\"closed\" />
-   <msnsubstatus substatus=\"offline\" />
-  </address>
- </atom>
-</presence>" check_it="true" search_in="body" assign_to="presence5" />
-    </action>
-  </recv>
-
-  <Reference variables="presence5" />
 
   <send>
     <![CDATA[

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie12bc27e1f0f3df6204c4e92acb2e93096c067a4
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list