[svn-commits] jrose: testsuite/asterisk/trunk r4127 - /asterisk/trunk/tests/channels/SIP/si...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Sep 6 13:23:27 CDT 2013
Author: jrose
Date: Fri Sep 6 13:23:25 2013
New Revision: 4127
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4127
Log:
testsuite: Add additional logging to SIP/sip_custom_presence/multiple_state_change
(issue ASTERISK-22216)
Reported by: Matt Jordan
Modified:
asterisk/trunk/tests/channels/SIP/sip_custom_presence/multiple_state_change/run-test
Modified: asterisk/trunk/tests/channels/SIP/sip_custom_presence/multiple_state_change/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_custom_presence/multiple_state_change/run-test?view=diff&rev=4127&r1=4126&r2=4127
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_custom_presence/multiple_state_change/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_custom_presence/multiple_state_change/run-test Fri Sep 6 13:23:25 2013
@@ -17,7 +17,7 @@
from asterisk.sipp import SIPpScenario
from twisted.internet import reactor
-logger = logging.getLogger(__name__)
+LOGGER = logging.getLogger(__name__)
TEST_DIR = os.path.dirname(os.path.realpath(__file__))
SIPP_SCENARIO = {
@@ -33,21 +33,29 @@
self.sipTest = SIPpScenario(TEST_DIR, SIPP_SCENARIO)
self.sippPassed = False
self.notifyPassed = False
+ self.notifyFailed = False
self.num_notifies = 0
def sippComplete(self, result):
+ LOGGER.info("SIPp scenario passed successfully. Raising sippPassed "
+ "flag.")
self.sippPassed = True
reactor.stop()
def originateComplete(self, result):
+ LOGGER.info("Completed originated call for setting presence to "
+ "custom away status, originating call to set status to "
+ "available.")
df = self.ami[0].originate(channel = "Local/available at default",
application = "Echo")
df.addErrback(self.handleOriginateFailure)
def runSippTest(self):
+ LOGGER.info("Running SIPp scenario")
df = self.sipTest.run(self)
df.addCallback(self.sippComplete)
+ LOGGER.info("Originating call to set presence to custom away status.")
df = self.ami[0].originate(channel = "Local/away at default", application = "Echo")
df.addErrback(self.handleOriginateFailure)
df.addCallback(self.originateComplete)
@@ -63,38 +71,42 @@
self.num_notifies = self.num_notifies + 1
+ LOGGER.info("Received notify %d of 3" % self.num_notifies)
+
if self.num_notifies > 3:
- logger.error("Too many NOTIFYs!")
+ LOGGER.error("Too many NOTIFYs! Dropping notifyPassed flag.")
self.notifyPassed = False
if self.num_notifies == 1:
if event.get("presencestate") != "away":
- logger.error("Incorrect presencestate value!")
- self.notifyPassed = False
+ LOGGER.error("Incorrect presencestate value!")
+ self.notifyFailed = True
ami.unregisterEvent("TestEvent")
if event.get("subtype") != "down the hall":
- logger.error("Incorrect presence subtype!")
- self.notifyPassed = False
+ LOGGER.error("Incorrect presence subtype!")
+ self.notifyFailed = True
ami.unregisterEvent("TestEvent")
if event.get("message") != "Quarterly financial meeting":
- logger.error("Incorrect presence message!")
- self.notifyPassed = False
+ LOGGER.error("Incorrect presence message!")
+ self.notifyFailed = True
ami.unregisterEvent("TestEvent")
else:
if event.get("presencestate") != "available":
- logger.error("Incorrect presencestate value!")
- self.notifyPassed = False
+ LOGGER.error("Incorrect presencestate value!")
+ self.notifyFailed = True
ami.unregisterEvent("TestEvent")
if event.get("subtype") != "":
- logger.error("Incorrect presence subtype!")
- self.notifyPassed = False
+ LOGGER.error("Incorrect presence subtype!")
+ self.notifyFailed = True
ami.unregisterEvent("TestEvent")
if event.get("message") != "":
- logger.error("Incorrect presence message!")
- self.notifyPassed = False
+ LOGGER.error("Incorrect presence message!")
+ self.notifyFailed = True
ami.unregisterEvent("TestEvent")
- if self.num_notifies == 3:
+ if self.num_notifies == 3 and not self.notifyFailed:
+ LOGGER.info("Received expected notify events. Raising "
+ "notifyPassed flag.")
self.notifyPassed = True
def ami_connect(self, ami):
@@ -115,6 +127,14 @@
test = MultipleStateChange()
reactor.run()
if not test.sippPassed or not test.notifyPassed:
+ if not test.sippPassed and not test.notifyPassed:
+ LOGGER.error("Test failed because the SIPp scenario failed to "
+ "complete expected notify events weren't received.")
+ elif not test.sippPassed:
+ LOGGER.error("Test failed because the SIPp scenario failed.")
+ else:
+ LOGGER.error("Test failed because expected notify events weren't "
+ "received.")
return 1
return 0
More information about the svn-commits
mailing list