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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jun 1 16:10:17 CDT 2010


Author: mmichelson
Date: Tue Jun  1 16:10:15 2010
New Revision: 320

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=320
Log:
Address David and Paul's review comments.


Modified:
    asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_test/test-config.yaml
    asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_test/test.lua
    asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test.lua
    asterisk/team/mmichelson/queue_tests/tests/queues/queue_baseline/test.lua
    asterisk/team/mmichelson/queue_tests/tests/queues/ringinuse_and_pause/test.lua
    asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/test.lua

Modified: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_test/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_test/test-config.yaml?view=diff&rev=320&r1=319&r2=320
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_test/test-config.yaml (original)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_test/test-config.yaml Tue Jun  1 16:10:15 2010
@@ -6,7 +6,7 @@
         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:

Modified: asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_test/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_test/test.lua?view=diff&rev=320&r1=319&r2=320
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_test/test.lua (original)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/macro_gosub_test/test.lua Tue Jun  1 16:10:15 2010
@@ -18,6 +18,23 @@
 		fail("error authenticating: " .. r["Message"])
 	end
 	return m
+end
+
+booted = nil
+function boot_event(event)
+	booted = true
+end
+
+function wait_until_booted(man)
+	man:register_event("FullyBooted", boot_event)
+	while not booted do
+		local res, err = man:wait_event()
+		if not res then
+			fail("Failure while waiting for FullyBooted event: " .. err)
+		end
+		man:process_events()
+	end
+	man:unregister_event("FullyBooted", boot_event)
 end
 
 function primary(event)
@@ -64,6 +81,11 @@
 		fail("Failure response from Originate: " .. res["Message"])
 	end
 
+	--When the originate returns, we know that the member
+	--has answered the call, but we can't guarantee that
+	--the macro or gosub has actually run, so sleep for a
+	--sec for safety's sake
+	posix.sleep(1)
 	res, err = man:pump_messages()
 	if not res then
 		fail("Error pumping messages: " .. err)
@@ -89,7 +111,11 @@
 
 man = manager_setup(instance)
 
+wait_until_booted(man)
+
 test_call("test1", man, primary)
 test_call("test2", man, secondary)
 
+logoff = ast.manager.action.logoff()
+man(logoff)
 instance:term_or_kill()

Modified: 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=diff&rev=320&r1=319&r2=320
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test.lua (original)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/position_priority_maxlen/test.lua Tue Jun  1 16:10:15 2010
@@ -27,6 +27,23 @@
 	instance:generate_manager_conf()
 	instance:spawn()
 	return instance
+end
+
+booted = nil
+function boot_event(event)
+	booted = true
+end
+
+function wait_until_booted(man)
+	man:register_event("FullyBooted", boot_event)
+	while not booted do
+		local res, err = man:wait_event()
+		if not res then
+			fail("Failure while waiting for FullyBooted event: " .. err)
+		end
+		man:process_events()
+	end
+	man:unregister_event("FullyBooted", boot_event)
 end
 
 function join_event(event)
@@ -75,6 +92,7 @@
 
 instance = setup_ast_instance()
 man = manager_setup(instance)
+wait_until_booted(man)
 test_call(nil, nil, 1) --1
 test_call(nil, nil, 2) --1,2
 test_call(1, nil, 1)   --3,1,2
@@ -87,3 +105,6 @@
 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
+logoff = ast.manager.action.logoff()
+man(logoff)
+instance:term_or_kill()

Modified: asterisk/team/mmichelson/queue_tests/tests/queues/queue_baseline/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/queue_baseline/test.lua?view=diff&rev=320&r1=319&r2=320
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/queue_baseline/test.lua (original)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/queue_baseline/test.lua Tue Jun  1 16:10:15 2010
@@ -18,6 +18,23 @@
 		fail("error authenticating: " .. r["Message"])
 	end
 	return m
+end
+
+booted = nil
+function boot_event(event)
+	booted = true
+end
+
+function wait_until_booted(man)
+	man:register_event("FullyBooted", boot_event)
+	while not booted do
+		local res, err = man:wait_event()
+		if not res then
+			fail("Failure while waiting for FullyBooted event: " .. err)
+		end
+		man:process_events()
+	end
+	man:unregister_event("FullyBooted", boot_event)
 end
 
 join = nil
@@ -83,6 +100,9 @@
 instance:spawn()
 
 man = manager_setup(instance)
+
+wait_until_booted(man)
+
 do_call(man)
 logoff = ast.manager.action.logoff()
 man(logoff)

Modified: asterisk/team/mmichelson/queue_tests/tests/queues/ringinuse_and_pause/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/queue_tests/tests/queues/ringinuse_and_pause/test.lua?view=diff&rev=320&r1=319&r2=320
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/ringinuse_and_pause/test.lua (original)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/ringinuse_and_pause/test.lua Tue Jun  1 16:10:15 2010
@@ -58,9 +58,25 @@
 	return instance
 end
 
+booted = nil
+function boot_event(event)
+	booted = true
+end
+
+function wait_until_booted(man)
+	man:register_event("FullyBooted", boot_event)
+	while not booted do
+		local res, err = man:wait_event()
+		if not res then
+			fail("Failure while waiting for FullyBooted event: " .. err)
+		end
+		man:process_events()
+	end
+	man:unregister_event("FullyBooted", boot_event)
+end
+
 function get_chan_name(event)
 	chan_name = event["Channel"]
-	print("Set the chan_name to " .. chan_name)
 end
 
 function busy_the_member(man)
@@ -98,7 +114,6 @@
 end
 
 function agent_called_handler(event)
-	print (event["ChannelCalling"])
 	actual_call_result = true
 end
 
@@ -124,28 +139,23 @@
 	--to fail.
 	if res["Response"] ~= originate_result then
 		fail("Unexpected originate result. Expected " .. originate_result .. " but got " .. res["Response"])
-	else
-		print("Good originate response")
 	end
 	man:pump_messages()
 	man:process_events()
 	if actual_call_result ~= expected_call_result then
 		fail("Unexpected AgentCalled result. Got " .. tostring(actual_call_result) .." but expected " .. tostring(expected_call_result))
-	else
-		print("Good AgentCalled result")
 	end
 	if actual_pause_result ~= pause_expectation then
 		fail("Unexpected QueueMemberPaused result")
-	else
-		print("Good QueueMemberPaused result")
 	end
 	man:unregister_event("AgentCalled", agent_called_handler)
 	man:unregister_event("QueueMemberPaused", agent_paused_handler)
 end
 
-ugugug = sipp_exec("sipp/uas.xml", "5061")
+sipp_proc = sipp_exec("sipp/uas.xml", "5061")
 a = setup_ast_instance()
 man = manager_setup(a)
+wait_until_booted(man)
 chan_name = nil
 
 busy_the_member(man)
@@ -161,16 +171,19 @@
 --jerk.
 test_call("queue2", "Error", true, true)
 unbusy_the_member(man)
-sipp_check_error(ugugug, "sipp/uas.xml")
-ugugug = sipp_exec("sipp/uas.xml", "5061")
+sipp_check_error(sipp_proc, "sipp/uas.xml")
+sipp_proc = sipp_exec("sipp/uas.xml", "5061")
 --Now the member is available. A call from
 --the first queue will work perfectly.
 test_call("queue1", "Success", true, false)
 --Have to restart the scenario since
 --it ends after a hangup
-sipp_check_error(ugugug, "sipp/uas.xml")
-ugugug = sipp_exec("sipp/uas.xml", "5061")
+sipp_check_error(sipp_proc, "sipp/uas.xml")
+sipp_proc = sipp_exec("sipp/uas.xml", "5061")
 --However, the member is paused in this queue,
 --so we should see no call attempt get made
 --at all.
 test_call("queue2", "Error", false, false)
+logoff = ast.manager.action.logoff()
+man(logoff)
+a:term_or_kill()

Modified: 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=diff&rev=320&r1=319&r2=320
==============================================================================
--- asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/test.lua (original)
+++ asterisk/team/mmichelson/queue_tests/tests/queues/wrapup_time/test.lua Tue Jun  1 16:10:15 2010
@@ -18,6 +18,23 @@
 		fail("error authenticating: " .. r["Message"])
 	end
 	return m
+end
+
+booted = nil
+function boot_event(event)
+	booted = true
+end
+
+function wait_until_booted(man)
+	man:register_event("FullyBooted", boot_event)
+	while not booted do
+		local res, err = man:wait_event()
+		if not res then
+			fail("Failure while waiting for FullyBooted event: " .. err)
+		end
+		man:process_events()
+	end
+	man:unregister_event("FullyBooted", boot_event)
 end
 
 function member1(event)
@@ -70,7 +87,7 @@
 	local orig = ast.manager.action:new("Originate")
 	orig["Channel"] = "Local/" .. exten .. "@test_context/n"
 	orig["Application"] = "Wait"
-	orig["Data"] = "3"
+	orig["Data"] = "1"
 	local res, err = man(orig)
 	if not res then
 		fail("Error originating call: " .. err)
@@ -90,7 +107,7 @@
 		fail("Originate successful when there should have been no available queue members")
 	end
 
-	posix.sleep(3)
+	posix.sleep(1)
 
 	res, err = man:pump_messages()
 	if not res then
@@ -118,6 +135,9 @@
 man1 = manager_setup(instance1)
 man2 = manager_setup(instance2)
 
+wait_until_booted(man1)
+wait_until_booted(man2)
+
 test_call(instance1, man1, member1, "test1")
 test_call(instance1, man1, member1, "test2")
 test_call(instance1, man1, member2, "test1")
@@ -127,3 +147,9 @@
 --originating a call to the queue will fail since
 --no one will answer
 test_call(instance2, man2, nil, "test1")
+logoff = ast.manager.action.logoff()
+man1(logoff)
+logoff = ast.manager.action.logoff()
+man2(logoff)
+instance1:term_or_kill()
+instance2:term_or_kill()




More information about the svn-commits mailing list