[svn-commits] mjordan: testsuite/asterisk/trunk r3613 - in /asterisk/trunk: configs/ lib/py...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Jan 22 10:19:32 CST 2013
Author: mjordan
Date: Tue Jan 22 10:19:26 2013
New Revision: 3613
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3613
Log:
Add tests to support ControlPlayback/Playback family of applications
This patch adds tests for the following:
* ControlPlayback application. These tests covers playing back a file in
a nominal setting, as well as control of the file playback. Control
of the file playback can occur either through DTMF from the channel or
through the AMI action ControlPlayback.
* Playback application. These tests cover playing back a file in a nominal
setting, as well as control of the file playback through the AMI action
ControlPlayback.
As a bonus, an asyncagi break command test has been added.
Review: https://reviewboard.asterisk.org/r/2270/
(issue ASTERISK-20882)
Reported by: mjordan
Added:
asterisk/trunk/tests/apps/control_playback/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/
asterisk/trunk/tests/apps/control_playback/control_forward/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/
asterisk/trunk/tests/apps/control_playback/control_forward/configs/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/configs/
asterisk/trunk/tests/apps/control_playback/control_forward/configs/ast1/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/configs/ast1/
asterisk/trunk/tests/apps/control_playback/control_forward/configs/ast1/extensions.conf
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/configs/ast1/extensions.conf
asterisk/trunk/tests/apps/control_playback/control_forward/test-config.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/test-config.yaml
asterisk/trunk/tests/apps/control_playback/control_pause/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/
asterisk/trunk/tests/apps/control_playback/control_pause/configs/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/configs/
asterisk/trunk/tests/apps/control_playback/control_pause/configs/ast1/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/configs/ast1/
asterisk/trunk/tests/apps/control_playback/control_pause/configs/ast1/extensions.conf
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/configs/ast1/extensions.conf
asterisk/trunk/tests/apps/control_playback/control_pause/test-config.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/test-config.yaml
asterisk/trunk/tests/apps/control_playback/control_restart/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/
asterisk/trunk/tests/apps/control_playback/control_restart/configs/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/configs/
asterisk/trunk/tests/apps/control_playback/control_restart/configs/ast1/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/configs/ast1/
asterisk/trunk/tests/apps/control_playback/control_restart/configs/ast1/extensions.conf
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/configs/ast1/extensions.conf
asterisk/trunk/tests/apps/control_playback/control_restart/test-config.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/test-config.yaml
asterisk/trunk/tests/apps/control_playback/control_reverse/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_reverse/
asterisk/trunk/tests/apps/control_playback/control_reverse/configs/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_reverse/configs/
asterisk/trunk/tests/apps/control_playback/control_reverse/configs/ast1/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_reverse/configs/ast1/
asterisk/trunk/tests/apps/control_playback/control_reverse/configs/ast1/extensions.conf
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_reverse/configs/ast1/extensions.conf
asterisk/trunk/tests/apps/control_playback/control_reverse/test-config.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_reverse/test-config.yaml
asterisk/trunk/tests/apps/control_playback/control_stop/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_stop/
asterisk/trunk/tests/apps/control_playback/control_stop/configs/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_stop/configs/
asterisk/trunk/tests/apps/control_playback/control_stop/configs/ast1/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_stop/configs/ast1/
asterisk/trunk/tests/apps/control_playback/control_stop/configs/ast1/extensions.conf
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_stop/configs/ast1/extensions.conf
asterisk/trunk/tests/apps/control_playback/control_stop/test-config.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/control_stop/test-config.yaml
asterisk/trunk/tests/apps/control_playback/nominal/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/nominal/
asterisk/trunk/tests/apps/control_playback/nominal/configs/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/nominal/configs/
asterisk/trunk/tests/apps/control_playback/nominal/configs/ast1/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/nominal/configs/ast1/
asterisk/trunk/tests/apps/control_playback/nominal/configs/ast1/extensions.conf
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/nominal/configs/ast1/extensions.conf
asterisk/trunk/tests/apps/control_playback/nominal/test-config.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/nominal/test-config.yaml
asterisk/trunk/tests/apps/control_playback/tests.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/control_playback/tests.yaml
asterisk/trunk/tests/apps/playback/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/
asterisk/trunk/tests/apps/playback/nominal/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/nominal/
asterisk/trunk/tests/apps/playback/nominal/configs/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/nominal/configs/
asterisk/trunk/tests/apps/playback/nominal/configs/ast1/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/nominal/configs/ast1/
asterisk/trunk/tests/apps/playback/nominal/configs/ast1/extensions.conf
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/nominal/configs/ast1/extensions.conf
asterisk/trunk/tests/apps/playback/nominal/test-config.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/nominal/test-config.yaml
asterisk/trunk/tests/apps/playback/remote_forward/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_forward/
asterisk/trunk/tests/apps/playback/remote_forward/configs/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_forward/configs/
asterisk/trunk/tests/apps/playback/remote_forward/configs/ast1/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_forward/configs/ast1/
asterisk/trunk/tests/apps/playback/remote_forward/configs/ast1/extensions.conf
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_forward/configs/ast1/extensions.conf
asterisk/trunk/tests/apps/playback/remote_forward/test-config.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_forward/test-config.yaml
asterisk/trunk/tests/apps/playback/remote_pause/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_pause/
asterisk/trunk/tests/apps/playback/remote_pause/configs/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_pause/configs/
asterisk/trunk/tests/apps/playback/remote_pause/configs/ast1/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_pause/configs/ast1/
asterisk/trunk/tests/apps/playback/remote_pause/configs/ast1/extensions.conf
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_pause/configs/ast1/extensions.conf
asterisk/trunk/tests/apps/playback/remote_pause/test-config.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_pause/test-config.yaml
asterisk/trunk/tests/apps/playback/remote_restart/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_restart/
asterisk/trunk/tests/apps/playback/remote_restart/configs/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_restart/configs/
asterisk/trunk/tests/apps/playback/remote_restart/configs/ast1/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_restart/configs/ast1/
asterisk/trunk/tests/apps/playback/remote_restart/configs/ast1/extensions.conf
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_restart/configs/ast1/extensions.conf
asterisk/trunk/tests/apps/playback/remote_restart/test-config.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_restart/test-config.yaml
asterisk/trunk/tests/apps/playback/remote_reverse/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_reverse/
asterisk/trunk/tests/apps/playback/remote_reverse/configs/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_reverse/configs/
asterisk/trunk/tests/apps/playback/remote_reverse/configs/ast1/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_reverse/configs/ast1/
asterisk/trunk/tests/apps/playback/remote_reverse/configs/ast1/extensions.conf
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_reverse/configs/ast1/extensions.conf
asterisk/trunk/tests/apps/playback/remote_reverse/test-config.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_reverse/test-config.yaml
asterisk/trunk/tests/apps/playback/remote_stop/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_stop/
asterisk/trunk/tests/apps/playback/remote_stop/configs/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_stop/configs/
asterisk/trunk/tests/apps/playback/remote_stop/configs/ast1/
- copied from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_stop/configs/ast1/
asterisk/trunk/tests/apps/playback/remote_stop/configs/ast1/extensions.conf
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_stop/configs/ast1/extensions.conf
asterisk/trunk/tests/apps/playback/remote_stop/test-config.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/remote_stop/test-config.yaml
asterisk/trunk/tests/apps/playback/tests.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/apps/playback/tests.yaml
asterisk/trunk/tests/asyncagi/
- copied from r3612, asterisk/team/mjordan/longcat/tests/asyncagi/
asterisk/trunk/tests/asyncagi/asyncagi_break/
- copied from r3612, asterisk/team/mjordan/longcat/tests/asyncagi/asyncagi_break/
asterisk/trunk/tests/asyncagi/asyncagi_break/asyncagi_break.py
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/asyncagi/asyncagi_break/asyncagi_break.py
asterisk/trunk/tests/asyncagi/asyncagi_break/configs/
- copied from r3612, asterisk/team/mjordan/longcat/tests/asyncagi/asyncagi_break/configs/
asterisk/trunk/tests/asyncagi/asyncagi_break/configs/ast1/
- copied from r3612, asterisk/team/mjordan/longcat/tests/asyncagi/asyncagi_break/configs/ast1/
asterisk/trunk/tests/asyncagi/asyncagi_break/configs/ast1/extensions.conf
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/asyncagi/asyncagi_break/configs/ast1/extensions.conf
asterisk/trunk/tests/asyncagi/asyncagi_break/test-config.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/asyncagi/asyncagi_break/test-config.yaml
asterisk/trunk/tests/asyncagi/tests.yaml
- copied unchanged from r3612, asterisk/team/mjordan/longcat/tests/asyncagi/tests.yaml
Modified:
asterisk/trunk/configs/manager.conf
asterisk/trunk/lib/python/asterisk/SimpleTestCase.py
asterisk/trunk/lib/python/asterisk/apptest.py
asterisk/trunk/lib/python/asterisk/asterisk.py
asterisk/trunk/tests/apps/tests.yaml
asterisk/trunk/tests/tests.yaml
Modified: asterisk/trunk/configs/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/configs/manager.conf?view=diff&rev=3613&r1=3612&r2=3613
==============================================================================
--- asterisk/trunk/configs/manager.conf (original)
+++ asterisk/trunk/configs/manager.conf Tue Jan 22 10:19:26 2013
@@ -8,7 +8,7 @@
[user]
secret = mysecret
-read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan,test
-write = system,call,agent,user,config,command,reporting,originate
+read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan,test,agi
+write = system,call,agent,user,config,command,reporting,originate,agi
#include "manager.users.conf.inc"
Modified: asterisk/trunk/lib/python/asterisk/SimpleTestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/SimpleTestCase.py?view=diff&rev=3613&r1=3612&r2=3613
==============================================================================
--- asterisk/trunk/lib/python/asterisk/SimpleTestCase.py (original)
+++ asterisk/trunk/lib/python/asterisk/SimpleTestCase.py Tue Jan 22 10:19:26 2013
@@ -172,7 +172,8 @@
self.passed = True
LOGGER.info("Test ending, hanging up current channels")
for chan in self._tracking_channels:
- self.ami[0].hangup(chan['channel']).addCallbacks(self.hangup)
+ self.ami[0].hangup(chan['channel']).addCallbacks(self.hangup,
+ self.hangup_error)
else:
self._current_run += 1
self.__start_new_call(ami)
@@ -184,6 +185,11 @@
LOGGER.info("Hangup complete, stopping reactor")
self.stop_reactor()
+ def hangup_error(self, result):
+ ''' Called when an error occurs during a hangup '''
+ # Ignore the hangup error - in this case, the channel was disposed of
+ # prior to our hangup request, which is okay
+ self.stop_reactor()
def verify_event(self, event):
''' Virtual method used to verify values in the event. '''
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=3613&r1=3612&r2=3613
==============================================================================
--- asterisk/trunk/lib/python/asterisk/apptest.py (original)
+++ asterisk/trunk/lib/python/asterisk/apptest.py Tue Jan 22 10:19:26 2013
@@ -61,7 +61,7 @@
self._scenarios = self.test_config['scenarios']
self.register_ami_observer(self.__ami_connect_handler)
-
+ self.register_stop_observer(self.end_scenario)
self.create_asterisk()
# Created successfully - set the singleton instance to this object
@@ -143,7 +143,7 @@
self.set_passed(True)
- def end_scenario(self):
+ def end_scenario(self, result=None):
''' End the current scenario '''
self.__evaluate_expected_results()
if len(self._scenarios) == 0:
@@ -250,12 +250,12 @@
else:
delay = 0
- self._ami = ami
- self._ami.registerEvent('Hangup', self.__hangup_event_handler)
- self._ami.registerEvent('VarSet', self.__varset_event_handler)
- self._ami.registerEvent('TestEvent', self.__test_event_handler)
- self._ami.registerEvent('Newexten', self.__new_exten_handler)
- self._ami.registerEvent('Newchannel', self.__new_channel_handler)
+ self.ami = ami
+ self.ami.registerEvent('Hangup', self.__hangup_event_handler)
+ self.ami.registerEvent('VarSet', self.__varset_event_handler)
+ self.ami.registerEvent('TestEvent', self.__test_event_handler)
+ self.ami.registerEvent('Newexten', self.__new_exten_handler)
+ self.ami.registerEvent('Newchannel', self.__new_channel_handler)
self._all_channels = [] # All channels we've detected
self._candidate_channels = [] # The local pair that are ours
self.app_channel = '' # The local half in the application
@@ -273,7 +273,7 @@
def spawn_call(self, delay=0):
''' Spawn the call! '''
def __spawn_call_callback(spawn_call_deferred):
- self._ami.originate(channel=self._channel_name,
+ self.ami.originate(channel=self._channel_name,
context=self._controller_context,
exten=self._controller_initial_exten,
priority='1',
@@ -304,7 +304,7 @@
LOGGER.debug("Ignoring redirect to %s; channel %s is hungup" %
(extension, self.controller_channel))
return
- self._ami.redirect(self.controller_channel,
+ self.ami.redirect(self.controller_channel,
self._controller_context,
extension,
1).addErrback(self.__handle_redirect_failure)
@@ -367,11 +367,11 @@
The callback parameter will be this object.
'''
- def __send_dtmf_initial(dtmf, __dtmf_deferred):
+ def __send_dtmf_initial(dtmf):
''' Initial callback called by the reactor. This sets the dialplan
variable DTMF_TO_SEND to the dtmf value to stream '''
if (self._previous_dtmf != dtmf):
- self._ami.setVar(channel=self.controller_channel,
+ self.ami.setVar(channel=self.controller_channel,
variable='DTMF_TO_SEND',
value=dtmf).addCallback(__send_dtmf_redirect)
self._previous_dtmf = dtmf
@@ -409,7 +409,7 @@
''' Initial callback called by the reactor. This sets the dialplan
variable TALK_AUDIO to the file to stream '''
if (self._previous_sound_file != sound_file):
- self._ami.setVar(channel=self.controller_channel,
+ self.ami.setVar(channel=self.controller_channel,
variable="TALK_AUDIO",
value=sound_file).addCallback(
__stream_audio_redirect)
@@ -780,6 +780,26 @@
return None
+class ActionSendMessage(object):
+ ''' Functor that sends some AMI message '''
+
+ def __init__(self, action_config):
+ self.add_app_channel = False if 'add-app-channel' not in action_config \
+ else action_config['add-app-channel']
+ self.add_control_channel = False if 'add-control-channel' not in action_config \
+ else action_config['add-control-channel']
+ if (self.add_app_channel and self.add_control_channel):
+ raise Exception('Only one channel can be added to the message!')
+ self.message_fields = action_config['fields']
+
+ def __call__(self, channel_object):
+ if self.add_app_channel:
+ self.message_fields['Channel'] = channel_object.app_channel
+ elif self.add_control_channel:
+ self.message_fields['Channel'] = channel_object.controller_channel
+ LOGGER.debug('Sending message: %s' % str(self.message_fields))
+ channel_object.ami.sendMessage(self.message_fields)
+
class ActionFactory(object):
''' A static class factory that maps action objects to text descriptions of
those objects, and provides a factory method for creating them '''
@@ -791,7 +811,8 @@
'set-expected-result': ActionSetExpectedResult,
'hangup': ActionHangup,
'fail-test': ActionFailTest,
- 'end-scenario': ActionEndScenario,}
+ 'end-scenario': ActionEndScenario,
+ 'send-ami-message': ActionSendMessage,}
@staticmethod
def create_action(action_def):
Modified: asterisk/trunk/lib/python/asterisk/asterisk.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/asterisk.py?view=diff&rev=3613&r1=3612&r2=3613
==============================================================================
--- asterisk/trunk/lib/python/asterisk/asterisk.py (original)
+++ asterisk/trunk/lib/python/asterisk/asterisk.py Tue Jan 22 10:19:26 2013
@@ -60,7 +60,6 @@
""" Callback from getProcessOutputAndValue """
self.__set_properties(result)
logger.debug("Asterisk CLI %s exited %d" % (self.host, self.exitcode))
- logger.debug(self.output)
if self.err:
logger.debug(self.err)
if self.exitcode:
@@ -72,7 +71,6 @@
""" Errback from getProcessOutputAndValue """
self.__set_properties(result)
logger.warning("Asterisk CLI %s exited %d with error: %s" % (self.host, self.exitcode, self.err))
- logger.debug(self.output)
if self.err:
logger.debug(self.err)
self.__deferred.errback(self)
@@ -115,7 +113,6 @@
def outReceived(self, data):
""" Override of ProcessProtocol.outReceived """
- logger.debug("Asterisk %s received: %s" % (self.__host, data))
self.output += data
def connectionMade(self):
Modified: asterisk/trunk/tests/apps/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/tests.yaml?view=diff&rev=3613&r1=3612&r2=3613
==============================================================================
--- asterisk/trunk/tests/apps/tests.yaml (original)
+++ asterisk/trunk/tests/apps/tests.yaml Tue Jan 22 10:19:26 2013
@@ -13,3 +13,5 @@
- test: 'directed_pickup'
- test: 'mixmonitor'
- test: 'mixmonitor_audiohook_inherit'
+ - dir: 'control_playback'
+ - dir: 'playback'
Modified: asterisk/trunk/tests/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/tests.yaml?view=diff&rev=3613&r1=3612&r2=3613
==============================================================================
--- asterisk/trunk/tests/tests.yaml (original)
+++ asterisk/trunk/tests/tests.yaml Tue Jan 22 10:19:26 2013
@@ -16,6 +16,7 @@
- test: 'masquerade'
- dir: 'fastagi'
- dir: 'agi'
+ - dir: 'asyncagi'
- dir: 'pbx'
- test: 'predial'
- dir: 'hangup'
More information about the svn-commits
mailing list