[svn-commits] mjordan: testsuite/asterisk/trunk r5463 - /asterisk/trunk/lib/python/asterisk/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Sat Aug 16 19:08:00 CDT 2014
Author: mjordan
Date: Sat Aug 16 19:07:50 2014
New Revision: 5463
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5463
Log:
apptest: Fix issue where duplicate event matches will re-run actions
When the action handling was modified for the inclusion of the off-nominal
authenticate test, a bug was introduced where a duplicate AMI event will
cause the same actions to be executed again. Previously, actions were
not removed from the action list and a counter was maintained that specified
where in the action lsit we were executing. Post the off-nominal test,
actions are removed from the list as they are executed. Unfortunately, the
actions on the list were copied, resulting in the original list being
maintained. This only caused an issue when the event matcher matched multiple
events; however, when that happened, the same actions would be executed.
This caused the confbridge triple lindy test to fail, as it spawned multiple
channels that were not expected.
Along the way, this patch also makes a small improvement to matching
application and candidate channels. Prior to this patch, application and
candidate channels could be tied together in a slightly more loose fashion;
now those channels must be either side of a Local channel pair. This fixes a
bug that was noticed when the triple lindy test was being debugged, wherein
the wrong application channel was paired with a controller channel.
Modified:
asterisk/trunk/lib/python/asterisk/apptest.py
Modified: asterisk/trunk/lib/python/asterisk/apptest.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/apptest.py?view=diff&rev=5463&r1=5462&r2=5463
==============================================================================
--- asterisk/trunk/lib/python/asterisk/apptest.py (original)
+++ asterisk/trunk/lib/python/asterisk/apptest.py Sat Aug 16 19:07:50 2014
@@ -540,7 +540,12 @@
self.app_channel = event['channel']
self._candidate_channels.remove(event['channel'])
- self.controller_channel = self._candidate_channels[0]
+ if (';2' in self.app_channel):
+ controller_name = self.app_channel.replace(';2', '') + ';1'
+ else:
+ controller_name = self.app_channel.replace(';1', '') + ';2'
+ self.controller_channel = controller_name
+ self._candidate_channels.remove(controller_name)
LOGGER.debug("Setting App Channel to %s; Controlling Channel to %s"
% (self.app_channel, self.controller_channel))
return (ami, event)
@@ -586,21 +591,20 @@
def event_callback(self, ami, event):
"""Override of AMIEventInstance event_callback."""
- actions = list(self.actions)
-
# If we aren't matching on a channel, then just execute the actions
if 'channel' not in event or len(self.channel_id) == 0:
- self.execute_next_action(actions=actions)
+ self.execute_next_action(actions=self.actions)
return
self.channel_obj = self.test_object.get_channel_object(self.channel_id)
+
# Its possible that the event matching could only be so accurate, as
# there may be multiple Local channel in the same extension. Make
# sure that this is actually for us by checking the Asterisk channel
# names
if (self.channel_obj.app_channel in event['channel']
or self.channel_obj.controller_channel in event['channel']):
- self.execute_next_action(actions=actions)
+ self.execute_next_action(actions=self.actions)
def execute_next_action(self, result=None, actions=None):
"""Execute the next action in the sequence"""
More information about the svn-commits
mailing list