[asterisk-commits] mmichelson: branch mmichelson/queue_tests r275 - in /asterisk/team/mmichelson...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Apr 30 15:59:01 CDT 2010
Author: mmichelson
Date: Fri Apr 30 15:58:58 2010
New Revision: 275
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=275
Log:
Add another queue test for testing position, priority, and maxlen of a queue.
Added:
asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/
asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/
asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/extensions.conf (with props)
asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/queues.conf (with props)
asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/run-test (with props)
asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test-config.yaml (with props)
asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test.lua (with props)
Added: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/extensions.conf?view=auto&rev=275
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/extensions.conf (added)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/extensions.conf Fri Apr 30 15:58:58 2010
@@ -1,0 +1,5 @@
+[test_context]
+
+exten => test,1,Answer
+exten => test,n,Queue(test_queue,,,,,,,,,${QUEUE_POS})
+exten => test,n,Hangup
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/queues.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/queues.conf?view=auto&rev=275
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/queues.conf (added)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/queues.conf Fri Apr 30 15:58:58 2010
@@ -1,0 +1,4 @@
+[test_queue]
+eventwhencalled=yes
+joinempty=yes
+maxlen=11
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/queues.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/queues.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/configs/queues.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/run-test?view=auto&rev=275
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/run-test (added)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/run-test Fri Apr 30 15:58:58 2010
@@ -1,0 +1,3 @@
+#!/bin/bash -e
+
+asttest -a / -s tests/queues/position_priority_maxlen
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test-config.yaml?view=auto&rev=275
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test-config.yaml (added)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test-config.yaml Fri Apr 30 15:58:58 2010
@@ -1,0 +1,14 @@
+testinfo:
+ summary: 'Ensure queue callers are entered into the proper position in the queue.'
+ description: |
+ "This test enters several callers into a queue, assigning various priorities and
+ positions to the callers. As each caller enters, we inspect the 'Join' manager event
+ to ensure that the caller has entered the queue in the position we expect."
+
+properties:
+ minversion: 'trunk'
+ dependencies:
+ - app : 'bash'
+ - app : 'sipp'
+ - app : 'asttest'
+
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test.lua?view=auto&rev=275
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test.lua (added)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test.lua Fri Apr 30 15:58:58 2010
@@ -1,0 +1,89 @@
+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, err = 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 setup_ast_instance()
+ local instance = ast.new()
+ instance:load_config("configs/extensions.conf")
+ instance:load_config("configs/queues.conf")
+ instance:generate_manager_conf()
+ instance:spawn()
+ return instance
+end
+
+function join_event(event)
+ actual_position = tonumber(event["Position"])
+end
+
+function test_call(priority, position, expected_position)
+ local prio_string = ""
+ local pos_string = ""
+ local comma = ""
+ actual_position = nil
+ man:register_event("Join", join_event)
+ local orig = ast.manager.action:new("Originate")
+ orig["Channel"] = "Local/test at test_context/n"
+ orig["Application"] = "Wait"
+ orig["Data"] = "100"
+ if priority then
+ prio_string = "QUEUE_PRIO=" .. priority
+ end
+ if position then
+ pos_string = "QUEUE_POS=" .. position
+ end
+ if position and priority then
+ comma = ","
+ end
+ orig["Variable"] = pos_string .. comma .. prio_string
+ local res, err = man(orig)
+ if not res then
+ fail("Failed to send originate: " .. err)
+ end
+
+ if res["Response"] ~= "Success" then
+ fail("Originate response is an error: " .. res["Message"])
+ end
+ posix.sleep(1)
+ res, err = man:pump_messages()
+ if not res then
+ fail("Error pumping messages: " .. err)
+ end
+ man:process_events()
+ man:unregister_event("Join", join_event)
+ if actual_position ~= expected_position then
+ fail("Expected caller to enter at position " .. tostring(expected_position) .. " but entered at " .. tostring(actual_position))
+ end
+end
+
+instance = setup_ast_instance()
+man = manager_setup(instance)
+test_call(nil, nil, 1) --1
+test_call(nil, nil, 2) --1,2
+test_call(1, nil, 1) --3,1,2
+test_call(1, nil, 2) --3,4,1,2
+test_call(2, nil, 1) --5,3,4,1,2
+test_call(nil, 5, 5) --5,3,4,1,6,2
+test_call(nil, 200, 7) --5,3,4,1,6,2,7
+test_call(nil, 1, 4) --5,3,4,8,1,6,2,7
+test_call(8, 3, 1) --9,5,3,4,8,1,6,2,7
+test_call(1, 7, 5) --9,5,3,4,10,8,1,6,2,7
+test_call(1, 4, 4) --9,5,3,11,4,10,8,1,6,2,7
+test_call(2, 5, nil) --Can't enter due to maxlen
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test.lua
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test.lua
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test.lua
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the asterisk-commits
mailing list