Author: mjordan Date: Sat Feb 14 19:18:45 2015 New Revision: 6424 URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=6424 Log: tests/manager/mixmonitor: Make test more reliable
There were two problems with the manager/mixmonitor test: (1) The test triggered the sound check on the hangup of the Local channel that was recorded. Unfortunately, that isn't reliable: MixMonitor runs in a separate thread, and you aren't guaranteed that the recording has finished when the recorded channel hangs up. This patch changes the test to trigger off of a TestEvent that fires when the MixMonitor has finished. Note that due to where that TestEvent was firing, the minversion on the test has been changed to align with a patch that made that event more reliable as well. (2) The pluggable module SoundChecker failed to actually look at the match fields it was told to match on. That pluggable module has been updated to look at all the match fields... as that's kind of helpful. Modified: asterisk/trunk/lib/python/asterisk/pluggable_modules.py asterisk/trunk/tests/manager/mixmonitor/test-config.yaml Modified: asterisk/trunk/lib/python/asterisk/pluggable_modules.py URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/pluggable_modules.py?view=diff&rev=6424&r1=6423&r2=6424 ============================================================================== --- asterisk/trunk/lib/python/asterisk/pluggable_modules.py (original) +++ asterisk/trunk/lib/python/asterisk/pluggable_modules.py Sat Feb 14 19:18:45 2015 @@ -521,11 +521,20 @@ instance_id = config.get('id', 0) if ami.id != instance_id: return + current_trigger = config['trigger']['match'] - if current_trigger.get('channel'): - if not (re.match(current_trigger.get('channel'), - event.get('channel'))): + for key, value in current_trigger.iteritems(): + if key.lower() not in event: + LOGGER.debug("Condition %s not in event, returning", key) return + if not re.match(value, event.get(key.lower())): + LOGGER.debug("Condition %s: %s does not match %s: %s in event", + key, value, key, event.get(key.lower())) + return + else: + LOGGER.debug("Condition %s: %s matches %s: %s in event", + key, value, key, event.get(key.lower())) + ami.deregisterEvent(current_trigger.get('event'), self.sound_check_start) self.sound_file = config['sound-file'] @@ -565,7 +574,7 @@ ami- the AMI instance used by this test """ current_trigger = self.module_config[self.index]['trigger']['match'] - trigger_id = current_trigger.get('id', 0) + trigger_id = self.module_config[self.index]['trigger'].get('id', 0) if ami.id != trigger_id: return if not current_trigger: Modified: asterisk/trunk/tests/manager/mixmonitor/test-config.yaml URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/mixmonitor/test-config.yaml?view=diff&rev=6424&r1=6423&r2=6424 ============================================================================== --- asterisk/trunk/tests/manager/mixmonitor/test-config.yaml (original) +++ asterisk/trunk/tests/manager/mixmonitor/test-config.yaml Sat Feb 14 19:18:45 2015 @@ -64,9 +64,9 @@ - trigger: match: - id: 0 - event: 'Hangup' - channel: 'Local/s@default-.*' + event: 'TestEvent' + type: 'StateChange' + state: 'MIXMONITOR_END' id: 0 sound-file: file-name: 'monitor/theRecording.wav' @@ -84,10 +84,11 @@ priority: '1' properties: - minversion: '11.0.0' + minversion: ['11.16.0', '13.3.0'] dependencies: - python : 'twisted' - python : 'starpy' - asterisk: 'app_mixmonitor' + - buildoption: 'TEST_FRAMEWORK' tags: - mixmonitor -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- svn-commits mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/svn-commits