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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 16 11:31:07 CDT 2010


Author: mmichelson
Date: Fri Apr 16 11:31:05 2010
New Revision: 231

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=231
Log:
Add queue wrapuptime test.


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

Added: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/ast1/queues.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/ast1/queues.conf?view=auto&rev=231
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/ast1/queues.conf (added)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/ast1/queues.conf Fri Apr 16 11:31:05 2010
@@ -1,0 +1,17 @@
+[test_queue1]
+eventwhencalled=yes
+strategy=linear
+timeout=1
+retry=1
+wrapuptime=10000
+member => Local/member1 at test_context/n,,member1
+member => Local/member2 at test_context/n,,member2
+
+[test_queue2]
+eventwhencalled=yes
+strategy=linear
+timeout=1
+retry=1
+wrapuptime=10000
+member => Local/member1 at test_context/n,,member1
+member => Local/member2 at test_context/n,,member2

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/ast1/queues.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/ast1/queues.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/ast1/queues.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/ast2/queues.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/ast2/queues.conf?view=auto&rev=231
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/ast2/queues.conf (added)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/ast2/queues.conf Fri Apr 16 11:31:05 2010
@@ -1,0 +1,20 @@
+[general]
+shared_lastcall = yes
+
+[test_queue1]
+eventwhencalled=yes
+strategy=linear
+wrapuptime=10000
+timeout=1
+retry=1
+member => Local/member1 at test_context,,member1
+member => Local/member2 at test_context,,member2
+
+[test_queue2]
+eventwhencalled=yes
+strategy=linear
+wrapuptime=10000
+timeout=1
+retry=1
+member => Local/member1 at test_context,,member1
+member => Local/member2 at test_context,,member2

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/ast2/queues.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/ast2/queues.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/ast2/queues.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/extensions.conf?view=auto&rev=231
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/extensions.conf (added)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/extensions.conf Fri Apr 16 11:31:05 2010
@@ -1,0 +1,15 @@
+[test_context]
+
+exten => member1,1,Answer
+exten => member1,n,Wait(1)
+exten => member1,n,Hangup
+
+exten => member2,1,Answer
+exten => member2,n,Wait(1)
+exten => member2,n,Hangup
+
+exten => test1,1,Queue(test_queue1,n)
+exten => test1,n,Hangup
+
+exten => test2,1,Queue(test_queue2)
+exten => test2,n,Hangup

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/configs/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/run-test?view=auto&rev=231
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/run-test (added)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/run-test Fri Apr 16 11:31:05 2010
@@ -1,0 +1,3 @@
+#!/bin/bash -e
+
+asttest -a / -s tests/queues/wrapup_time

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

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

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

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

Added: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/test-config.yaml?view=auto&rev=231
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/test-config.yaml (added)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/test-config.yaml Fri Apr 16 11:31:05 2010
@@ -1,0 +1,12 @@
+testinfo:
+    summary:     'Test wrapuptime for queues'
+    description: |
+        'This test runs two instances of Asterisk. One has shared_lastcall set in queues.conf
+        and the other does not. Each instance of Asterisk contains two queues with the same two
+        members in each queue. We place calls to the queues in a way such that we can properly
+        see if wrapuptime is honored.'
+
+properties:
+    minversion: '1.6.0'
+    dependencies:
+        - app: 'asttest'

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

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

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

Added: asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/test.lua?view=auto&rev=231
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/test.lua (added)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/test.lua Fri Apr 16 11:31:05 2010
@@ -1,0 +1,129 @@
+function manager_setup(a)
+	local m,err = a:manager_connect()
+	if not m then
+		fail("error connecting to asterisk: " .. err)
+	end
+
+	login = ast.manager.action.login()
+	if not login then
+		fail("Couldn't create login?")
+	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 member1(event)
+	--Userful for debugging
+	--print("Got member1")
+	--print("Queue: " .. tostring(event["Queue"]))
+	--print("Uniqueid: " .. tostring(event["Uniqueid"]))
+	--print("Channel: " .. tostring(event["Channel"]))
+	--print("Member: " .. tostring(event["Member"]))
+	--print("MemberName: " .. tostring(event["MemberName"]))
+	--print("Holdtime: " .. tostring(event["Holdtime"]))
+	--print("BridgedChannel: " .. tostring(event["BridgedChannel"]))
+	--print("Ringtime: " .. tostring(event["Ringtime"]))
+	if event["MemberName"] == "member1" then
+		pass = true
+	else
+		print(event["Membername"])
+	end
+end
+
+function member2(event)
+	--print("Got member2")
+	--print("Queue: " .. tostring(event["Queue"]))
+	--print("Uniqueid: " .. tostring(event["Uniqueid"]))
+	--print("Channel: " .. tostring(event["Channel"]))
+	--print("Member: " .. tostring(event["Member"]))
+	--print("MemberName: " .. tostring(event["MemberName"]))
+	--print("Holdtime: " .. tostring(event["Holdtime"]))
+	--print("BridgedChannel: " .. tostring(event["BridgedChannel"]))
+	--print("Ringtime: " .. tostring(event["Ringtime"]))
+	if event["MemberName"] == "member2" then
+		pass = true
+	end
+end
+
+function setup_ast_instance(which)
+	local instance = ast.new()
+	instance:load_config("configs/extensions.conf")
+	instance:load_config("configs/" .. which .. "/queues.conf")
+	instance:generate_manager_conf()
+	instance:spawn()
+	return instance
+end
+
+function test_call(ast_instance, man, handler, exten)
+	if handler then
+		man:register_event("AgentConnect", handler)
+		pass = false
+	end
+	local orig = ast.manager.action:new("Originate")
+	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
+		if not handler then
+			--When the handler is nil, this means we expect that no
+			--queue members will be available to answer the call. Since
+			--no one can answer the originated call, the originate will
+			--fail. If it doesn't, then something went wrong.
+			return
+		else
+			fail("Response failure for Originate: " .. res["Message"])
+		end
+	elseif not handler then
+		fail("Originate successful when there should have been no available queue members")
+	end
+
+	posix.sleep(3)
+
+	res, err = man:pump_messages()
+	if not res then
+		fail("Error pumping messages: " .. err)
+	end
+
+	man:process_events()
+	if not pass then
+		if handler == member1 then
+			fail("Did not get AgentConnect for member1 as expected")
+		elseif handler == member2 then
+			fail("Did not get AgentConnect for member2 as expected")
+		else
+			fail("Got AgentConnect when we should not have gotten one")
+		end
+	end
+	man:unregister_event("AgentConnect", handler)
+end
+
+instance1 = setup_ast_instance("ast1")
+instance2 = setup_ast_instance("ast2")
+
+posix.sleep(1)
+
+man1 = manager_setup(instance1)
+man2 = manager_setup(instance2)
+
+test_call(instance1, man1, member1, "test1")
+test_call(instance1, man1, member1, "test2")
+test_call(instance1, man1, member2, "test1")
+test_call(instance2, man2, member1, "test1")
+test_call(instance2, man2, member2, "test2")
+--On this call, since both members are unavailable,
+--originating a call to the queue will fail since
+--no one will answer
+test_call(instance2, man2, nil, "test1")

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

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

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




More information about the asterisk-commits mailing list