[asterisk-commits] mnicholson: testsuite/asterisk/trunk r222 - in /asterisk/trunk/tests: ./ mana...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 13 14:46:50 CDT 2010


Author: mnicholson
Date: Tue Apr 13 14:46:46 2010
New Revision: 222

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=222
Log:
Test an option to restore past broken behavor of the Events manager action

This tests a new feature to restore old broken behavior of the Events manager action by sending the action and checking the presence or absense of a response.

(related to issue #17023)


Added:
    asterisk/trunk/tests/manager-action-events-response/
    asterisk/trunk/tests/manager-action-events-response/run-test   (with props)
    asterisk/trunk/tests/manager-action-events-response/test-config.yaml   (with props)
    asterisk/trunk/tests/manager-action-events-response/test.lua   (with props)
Modified:
    asterisk/trunk/tests/tests.yaml

Added: asterisk/trunk/tests/manager-action-events-response/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager-action-events-response/run-test?view=auto&rev=222
==============================================================================
--- asterisk/trunk/tests/manager-action-events-response/run-test (added)
+++ asterisk/trunk/tests/manager-action-events-response/run-test Tue Apr 13 14:46:46 2010
@@ -1,0 +1,4 @@
+#!/bin/bash -e
+export LUA_PATH=../../lib/lua/?.lua\;\;
+export LUA_CPATH=../../lib/lua/?.so\;\;
+asttest -a / -s tests/manager-action-events-response

Propchange: asterisk/trunk/tests/manager-action-events-response/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/manager-action-events-response/run-test
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/manager-action-events-response/run-test
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/manager-action-events-response/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/manager-action-events-response/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager-action-events-response/test-config.yaml?view=auto&rev=222
==============================================================================
--- asterisk/trunk/tests/manager-action-events-response/test-config.yaml (added)
+++ asterisk/trunk/tests/manager-action-events-response/test-config.yaml Tue Apr 13 14:46:46 2010
@@ -1,0 +1,15 @@
+testinfo:
+    summary:     'Test the presence and absence of a response from the Events manager action'
+    description: |
+        "This test ensure asterisk either responds or does not respond to
+        various values of the EventMaks parameter of the Events manager
+        action."
+    issues:
+        - mantis : '17023'
+
+properties:
+    minversion: '1.4'
+    dependencies:
+        - app : 'bash'
+        - app : 'asttest'
+

Propchange: asterisk/trunk/tests/manager-action-events-response/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/manager-action-events-response/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/manager-action-events-response/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/manager-action-events-response/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager-action-events-response/test.lua?view=auto&rev=222
==============================================================================
--- asterisk/trunk/tests/manager-action-events-response/test.lua (added)
+++ asterisk/trunk/tests/manager-action-events-response/test.lua Tue Apr 13 14:46:46 2010
@@ -1,0 +1,75 @@
+
+function check_err(msg, r, err)
+	if not r then
+		error(msg .. ": " .. err)
+	end
+	return r
+end
+
+function test_events_response(asterisk, event_mask, expected_response)
+	local got_response
+
+	print("sending 'EventMask: " .. event_mask .. "'")
+
+	local m = check_err("error connecting to asterisk", asterisk:manager_connect())
+
+	local r = check_err("error authenticating", m(action.login()))
+	if r["Response"] ~= "Success" then
+		error("error authenticating: " .. r["Message"])
+	end
+
+
+	local ma = action.new("Events")
+	ma["EventMask"] = event_mask
+
+	function handle_response(r)
+		got_response = r
+	end
+
+	r = check_err("error sending 'Events' action", m(ma, handle_response))
+	posix.sleep(3)
+	check_err("manager error", m:pump_messages())
+	m:process_responses()
+
+	if not got_response and expected_response then
+		fail("did not get a response to the 'Events' manager action in 3 seconds")
+	elseif got_response and not expected_response then
+		fail("got a response to the 'Events' manager action when we did not expect one:\n" .. got_response:_format())
+	end
+end
+
+action = ast.manager.action
+
+print("testing with brokeneventsaction off (default)")
+standard = ast.new()
+standard:generate_manager_conf()
+standard:spawn()
+
+test_events_response(standard, "", true)
+test_events_response(standard, "ON", true)
+test_events_response(standard, "yes", true)
+test_events_response(standard, "all", true)
+test_events_response(standard, "all,user", true)
+test_events_response(standard, "system,user,agent", true)
+test_events_response(standard, "off", true)
+test_events_response(standard, "none", true)
+test_events_response(standard, "yeah whatever", true)
+test_events_response(standard, "1", true)
+
+print("testing with brokeneventsaction on")
+quirks = ast.new()
+quirks:generate_manager_conf()
+quirks["manager.conf"]["general"]["brokeneventsaction"] = "yes"
+quirks:spawn()
+
+test_events_response(quirks, "", false)
+test_events_response(quirks, "ON", false)
+test_events_response(quirks, "yes", false)
+test_events_response(quirks, "all", false)
+test_events_response(quirks, "all,user", false)
+test_events_response(quirks, "system,user,agent", true)
+test_events_response(quirks, "off", true)
+test_events_response(quirks, "none", true)
+test_events_response(quirks, "yeah whatever", true)
+test_events_response(quirks, "1", true)
+

Propchange: asterisk/trunk/tests/manager-action-events-response/test.lua
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/manager-action-events-response/test.lua
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/manager-action-events-response/test.lua
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/tests.yaml?view=diff&rev=222&r1=221&r2=222
==============================================================================
--- asterisk/trunk/tests/tests.yaml (original)
+++ asterisk/trunk/tests/tests.yaml Tue Apr 13 14:46:46 2010
@@ -6,3 +6,4 @@
     - test: 'rfc2833_dtmf_detect'
     - test: 'sip_channel_params'
     - test: 'iax-call-basic'
+    - test: 'manager-action-events-response'




More information about the asterisk-commits mailing list