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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 24 07:32:32 CDT 2016


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

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. This would cause the
tests to fail. These were also observed on other systems.

The first issue is that on some systems two PUBLISH requests may
be sent for the not in use state. This is because the custom device
state is set to not in use by default and we also set it to not
in use. Depending on the system this may or may not result in two
requests being sent. We now don't set it to not in use state
until all other states have been cycled through. This ensures that
only one initial not in use PUBLISH request goes out.

It was also observed that in some cases a state in between may
be skipped if changes were processed quickly. A delay has been
introduced to allow time for the PUBLISH request to get sent.

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, 44 insertions(+), 44 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



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..d5c471e 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
@@ -1,10 +1,15 @@
 [default]
 exten => presence,hint,Custom:presence
 
-exten => change_state,1,Set(DEVICE_STATE(Custom:presence)=NOT_INUSE)
+exten => change_state,1,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)
+	same => n,Set(DEVICE_STATE(Custom:presence)=NOT_INUSE)
+	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..647d1e1 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,6 +92,11 @@
 <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>
+  <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="presence4" />
     </action>
@@ -119,12 +124,7 @@
       <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>
+  <state>terminated</state>
  </dialog>
 </dialog-info>" check_it="true" search_in="body" assign_to="presence5" />
     </action>
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..d5c471e 100644
--- a/tests/channels/pjsip/publish/presence_pidf/configs/ast1/extensions.conf
+++ b/tests/channels/pjsip/publish/presence_pidf/configs/ast1/extensions.conf
@@ -1,10 +1,15 @@
 [default]
 exten => presence,hint,Custom:presence
 
-exten => change_state,1,Set(DEVICE_STATE(Custom:presence)=NOT_INUSE)
+exten => change_state,1,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)
+	same => n,Set(DEVICE_STATE(Custom:presence)=NOT_INUSE)
+	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..eb97c2a 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>
@@ -150,17 +152,15 @@
     <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>
+ <note>Ready</note>
  <tuple id=\"presence\">
   <status>
-   <basic>closed</basic>
+   <basic>open</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>
+  <status />
  </pp:person>
 </presence>" check_it="true" search_in="body" assign_to="presence5" />
     </action>
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..d5c471e 100644
--- a/tests/channels/pjsip/publish/presence_xpidf/configs/ast1/extensions.conf
+++ b/tests/channels/pjsip/publish/presence_xpidf/configs/ast1/extensions.conf
@@ -1,10 +1,15 @@
 [default]
 exten => presence,hint,Custom:presence
 
-exten => change_state,1,Set(DEVICE_STATE(Custom:presence)=NOT_INUSE)
+exten => change_state,1,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)
+	same => n,Set(DEVICE_STATE(Custom:presence)=NOT_INUSE)
+	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..599009d 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" />
@@ -137,8 +137,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=\"closed\" />
-   <msnsubstatus substatus=\"offline\" />
+   <status status=\"open\" />
+   <msnsubstatus substatus=\"online\" />
   </address>
  </atom>
 </presence>" check_it="true" search_in="body" assign_to="presence5" />
@@ -146,20 +146,5 @@
   </recv>
 
   <Reference variables="presence5" />
-
-  <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>

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie12bc27e1f0f3df6204c4e92acb2e93096c067a4
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list