[asterisk-commits] mmichelson: branch mmichelson/queue_tests r227 - in /asterisk/team/mmichelson...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 15 14:17:52 CDT 2010


Author: mmichelson
Date: Thu Apr 15 14:17:50 2010
New Revision: 227

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=227
Log:
Add queue test for macro and gosub execution.


Added:
    asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/run-test   (with props)
    asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test-config.yaml   (with props)
    asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test.lua   (with props)
Modified:
    asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/configs/extensions.conf

Modified: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/configs/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/configs/extensions.conf?view=diff&rev=227&r1=226&r2=227
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/configs/extensions.conf (original)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/configs/extensions.conf Thu Apr 15 14:17:50 2010
@@ -1,31 +1,27 @@
 [test_context]
 
-extension => caller,1,Answer
-extension => caller,n,Wait(2)
-extension => caller,n,Hangup
+exten => answerer,1,Answer
+exten => answerer,n,Wait(2)
+exten => answerer,n,Hangup
 
-extension => answerer,1,Answer
-extension => answerer,n,Wait(2)
-extension => answerer,n,Hangup
+exten => test1,1,Queue(test_queue)
+exten => test1,n,Hangup
 
-extension => test1,1,Queue(test_queue)
-extension => test1,n,Hangup
-
-extension => test2,1,Queue(test_queue,,,,,,secondarymacro,secondarygosub)
-extension => test2,n,Hangup
+exten => test2,1,Queue(test_queue,,,,,,secondarymacro,secondarygosub)
+exten => test2,n,Hangup
 
 [macro-primarymacro]
-extension => s,1,Set(MACROVAR=primarymacro)
-extension => s,n,MacroExit
+exten => s,1,Set(MACROVAR=primarymacro)
+exten => s,n,MacroExit
 
 [macro-secondarymacro]
-extension => s,1,Set(MACROVAR=secondarymacro)
-extension => s,n,MacroExit
+exten => s,1,Set(MACROVAR=secondarymacro)
+exten => s,n,MacroExit
 
 [primarygosub]
-extension => s,1,Set(GOSUBVAR=primarygosub)
-extension => s,n,Return
+exten => s,1,Set(GOSUBVAR=primarygosub)
+exten => s,n,Return
 
 [secondarygosub]
-extension => s,1,Set(GOSUBVAR=secondarygosub)
-extension => s,n,Return
+exten => s,1,Set(GOSUBVAR=secondarygosub)
+exten => s,n,Return

Added: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/run-test?view=auto&rev=227
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/run-test (added)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/run-test Thu Apr 15 14:17:50 2010
@@ -1,0 +1,3 @@
+#!/bin/bash -e
+
+asttest -a / -s tests/queues/macro_gosub_agi_test

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/run-test
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/run-test
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test-config.yaml?view=auto&rev=227
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test-config.yaml (added)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test-config.yaml Thu Apr 15 14:17:50 2010
@@ -1,0 +1,13 @@
+testinfo:
+    summary:     'Test Macro and Gosub execution upon answer of Queue calls'
+    description: |
+        'This test runs two calls through a queue. The queue is configured to run
+        a particular macro and gosub when a member answers. For the first call, we
+        ensure that the configured membermacro and membergosub are executed. In the
+        second call, we give overriding parameters to the Queue() application and
+        ensure that those are run instead.'
+        
+properties:
+    minversion: '1.6.0'
+    dependencies:
+        - app: 'asttest'

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test.lua?view=auto&rev=227
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test.lua (added)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test.lua Thu Apr 15 14:17:50 2010
@@ -1,0 +1,95 @@
+function manager_setup(a)
+	local m,err = a:manager_connect()
+	if not m then
+		fail("error connecting to asterisk: " .. err)
+	end
+
+	local login = ast.manager.action.login()
+	if not login then
+		fail("Failed to create manager login action")
+	end
+
+	local r = m(login)
+	if not r then
+		fail("error logging in to the manager: " .. err)
+	end
+
+	if r["Response"] ~= "Success" then
+		fail("error authenticating: " .. r["Message"])
+	end
+	return m
+end
+
+function primary(event)
+	if event["Variable"] == "MACROVAR" then
+		if event["Value"] == "primarymacro" then
+			passmacro = true
+		end
+	end
+	if event["Variable"] == "GOSUBVAR" then
+		if event["Value"] == "primarygosub" then
+			passgosub = true
+		end
+	end
+end
+
+function secondary(event)
+	if event["Variable"] == "MACROVAR" then
+		if event["Value"] == "secondarymacro" then
+			passmacro = true
+		end
+	end
+	if event["Variable"] == "GOSUBVAR" then
+		if event["Value"] == "secondarygosub" then
+			passgosub = true
+		end
+	end
+end
+
+function test_call(exten, man, handler)
+	passmacro = false
+	passgosub = false
+	local orig = ast.manager.action:new("Originate")
+	man:register_event("VarSet", handler)
+	orig["Channel"] = "Local/" .. exten .."@test_context/n"
+	orig["Application"] = "Wait"
+	orig["Data"] = "3"
+
+	local res,err = man(orig)
+	if not res then
+		fail("Error originating call: " .. err)
+	end
+
+	if res["Response"] ~= "Success" then
+		fail("Failure response from Originate: " .. res["Message"])
+	end
+
+	res, err = man:pump_messages()
+	if not res then
+		fail("Error pumping messages: " .. err)
+	end
+
+	man:process_events()
+	man:unregister_event("VarSet", handler)
+
+	if not passmacro then
+		fail("Did not get expected macro variable set")
+	end
+
+	if not passgosub then
+		fail("Did not get expected gosub variable set")
+	end
+end
+
+instance = ast.new()
+instance:load_config("configs/extensions.conf")
+instance:load_config("configs/queues.conf")
+instance:generate_manager_conf()
+instance:spawn()
+
+man = manager_setup(instance)
+
+test_call("test1", man, primary)
+test_call("test2", man, secondary)
+
+instance:term_or_kill()

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test.lua
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test.lua
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_agi_test/test.lua
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the asterisk-commits mailing list