[asterisk-commits] mnicholson: testsuite/asterisk/trunk r1471 - in /asterisk/trunk/tests: manage...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 21 16:41:57 CDT 2011


Author: mnicholson
Date: Thu Apr 21 16:41:52 2011
New Revision: 1471

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1471
Log:
Added tests for new manager and sip connection limiting security features

Added:
    asterisk/trunk/tests/manager/authlimit/
    asterisk/trunk/tests/manager/authlimit/run-test   (with props)
    asterisk/trunk/tests/manager/authlimit/test-config.yaml   (with props)
    asterisk/trunk/tests/manager/authlimit/test.lua   (with props)
    asterisk/trunk/tests/manager/authtimeout/
    asterisk/trunk/tests/manager/authtimeout/run-test   (with props)
    asterisk/trunk/tests/manager/authtimeout/test-config.yaml   (with props)
    asterisk/trunk/tests/manager/authtimeout/test.lua   (with props)
    asterisk/trunk/tests/sip/tcpauthlimit/
    asterisk/trunk/tests/sip/tcpauthlimit/run-test   (with props)
    asterisk/trunk/tests/sip/tcpauthlimit/test-config.yaml   (with props)
    asterisk/trunk/tests/sip/tcpauthlimit/test.lua   (with props)
    asterisk/trunk/tests/sip/tcpauthtimeout/
    asterisk/trunk/tests/sip/tcpauthtimeout/run-test   (with props)
    asterisk/trunk/tests/sip/tcpauthtimeout/test-config.yaml   (with props)
    asterisk/trunk/tests/sip/tcpauthtimeout/test.lua   (with props)
Modified:
    asterisk/trunk/tests/manager/tests.yaml
    asterisk/trunk/tests/sip/tests.yaml

Added: asterisk/trunk/tests/manager/authlimit/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/authlimit/run-test?view=auto&rev=1471
==============================================================================
--- asterisk/trunk/tests/manager/authlimit/run-test (added)
+++ asterisk/trunk/tests/manager/authlimit/run-test Thu Apr 21 16:41:52 2011
@@ -1,0 +1,4 @@
+#!/usr/bin/env bash
+set -e
+. lib/sh/lua.sh
+asttest -a / -s `dirname $0` $@

Propchange: asterisk/trunk/tests/manager/authlimit/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/manager/authlimit/run-test
------------------------------------------------------------------------------
    svn:executable = *

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

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

Added: asterisk/trunk/tests/manager/authlimit/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/authlimit/test-config.yaml?view=auto&rev=1471
==============================================================================
--- asterisk/trunk/tests/manager/authlimit/test-config.yaml (added)
+++ asterisk/trunk/tests/manager/authlimit/test-config.yaml Thu Apr 21 16:41:52 2011
@@ -1,0 +1,15 @@
+testinfo:
+    summary:     'Test the authlimit manager config option.'
+    description: |
+        "This test ensures that the manager respects the authlimit config
+        option."
+    issues:
+        -mantis: 18996
+        -jira: SWP-3248
+
+properties:
+    minversion: '1.4'
+    dependencies:
+        - app : 'bash'
+        - app : 'asttest'
+

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

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

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

Added: asterisk/trunk/tests/manager/authlimit/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/authlimit/test.lua?view=auto&rev=1471
==============================================================================
--- asterisk/trunk/tests/manager/authlimit/test.lua (added)
+++ asterisk/trunk/tests/manager/authlimit/test.lua Thu Apr 21 16:41:52 2011
@@ -1,0 +1,51 @@
+function mcheck(msg, r, err)
+	check(msg, r, err)
+	if r["Response"] ~= "Success" then
+		if r["Message"] then
+			error(msg .. ": " .. r["Message"])
+		else
+			error(msg)
+		end
+	end
+
+	return r, err
+end
+
+action = ast.manager.action
+
+-- limit the manager to 5 connections
+limit = 5
+
+print("starting asterisk")
+a = ast.new()
+a:generate_manager_conf()
+a["manager.conf"]["general"]["authlimit"] = limit
+a:spawn()
+
+clients = {}
+
+print("connecting " .. limit .. " clients to asterisk")
+for i = 1, limit do
+	local m = check("error connecting client " .. i .. " to asterisk", a:manager_connect())
+	table.insert(clients, m)
+end
+
+print("attempting to connect one more, this should fail")
+fail_if(a:manager_connect(), "client " .. limit + 1 .. " successfully connected, this should have failed")
+
+for _, m in ipairs(clients) do
+	m:close()
+end
+
+posix.sleep(3) -- let the connections shut down
+
+print("connecting and authenticating " .. limit .. " clients to asterisk")
+for i = 1, limit do
+	local m = check("error connecting client " .. i .. " to asterisk", a:manager_connect())
+	mcheck("error authenticating client " .. i, m(action.login()))
+	table.insert(clients, m)
+end
+
+print("attempting to connect one more, this should succeed")
+fail_if(not a:manager_connect(), "client " .. limit + 1 .. " failed to connect")
+

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

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

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

Added: asterisk/trunk/tests/manager/authtimeout/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/authtimeout/run-test?view=auto&rev=1471
==============================================================================
--- asterisk/trunk/tests/manager/authtimeout/run-test (added)
+++ asterisk/trunk/tests/manager/authtimeout/run-test Thu Apr 21 16:41:52 2011
@@ -1,0 +1,4 @@
+#!/usr/bin/env bash
+set -e
+. lib/sh/lua.sh
+asttest -a / -s `dirname $0` $@

Propchange: asterisk/trunk/tests/manager/authtimeout/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/manager/authtimeout/run-test
------------------------------------------------------------------------------
    svn:executable = *

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

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

Added: asterisk/trunk/tests/manager/authtimeout/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/authtimeout/test-config.yaml?view=auto&rev=1471
==============================================================================
--- asterisk/trunk/tests/manager/authtimeout/test-config.yaml (added)
+++ asterisk/trunk/tests/manager/authtimeout/test-config.yaml Thu Apr 21 16:41:52 2011
@@ -1,0 +1,15 @@
+testinfo:
+    summary:     'Test the authtimeout manager config option.'
+    description: |
+        "This test ensures that the manager respects the authtimeout config
+        option."
+    issues:
+        -mantis: 18996
+        -jira: SWP-3248
+
+properties:
+    minversion: '1.4'
+    dependencies:
+        - app : 'bash'
+        - app : 'asttest'
+

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

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

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

Added: asterisk/trunk/tests/manager/authtimeout/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/authtimeout/test.lua?view=auto&rev=1471
==============================================================================
--- asterisk/trunk/tests/manager/authtimeout/test.lua (added)
+++ asterisk/trunk/tests/manager/authtimeout/test.lua Thu Apr 21 16:41:52 2011
@@ -1,0 +1,35 @@
+function mcheck(msg, r, err)
+	check(msg, r, err)
+	if r["Response"] ~= "Success" then
+		if r["Message"] then
+			error(msg .. ": " .. r["Message"])
+		else
+			error(msg)
+		end
+	end
+
+	return r, err
+end
+
+action = ast.manager.action
+
+-- timeout after 5 seconds by default
+timeout = 5
+
+print("starting asterisk")
+a = ast.new()
+a:generate_manager_conf()
+a["manager.conf"]["general"]["authtimeout"] = timeout
+a:spawn()
+
+print("testing timeout of an unauthenticated session")
+m = check("error connecting to asterisk", a:manager_connect())
+posix.sleep(timeout + 1)
+fail_if(m:pump_messages(), "asterisk did not close the connection after " .. timeout .. " seconds")
+
+print("testing timeout of an authenticated session (should not timeout)")
+m = check("error connecting to asterisk", a:manager_connect())
+mcheck("error logging in to asterisk", m(action.login()))
+posix.sleep(timeout * 2)
+fail_if(not m:pump_messages(), "asterisk timedout after successful authentication")
+

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

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

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

Modified: asterisk/trunk/tests/manager/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/tests.yaml?view=diff&rev=1471&r1=1470&r2=1471
==============================================================================
--- asterisk/trunk/tests/manager/tests.yaml (original)
+++ asterisk/trunk/tests/manager/tests.yaml Thu Apr 21 16:41:52 2011
@@ -2,5 +2,7 @@
 tests:
     - test: 'login'
     - test: 'action-events-response'
+    - test: 'authlimit'
+    - test: 'authtimeout'
     # Temporarily disabled while failures are debugged
     #- test: 'response-time'

Added: asterisk/trunk/tests/sip/tcpauthlimit/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip/tcpauthlimit/run-test?view=auto&rev=1471
==============================================================================
--- asterisk/trunk/tests/sip/tcpauthlimit/run-test (added)
+++ asterisk/trunk/tests/sip/tcpauthlimit/run-test Thu Apr 21 16:41:52 2011
@@ -1,0 +1,4 @@
+#!/usr/bin/env bash
+set -e
+. lib/sh/lua.sh
+asttest -a / -s `dirname $0` $@

Propchange: asterisk/trunk/tests/sip/tcpauthlimit/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/sip/tcpauthlimit/run-test
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/sip/tcpauthlimit/run-test
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/sip/tcpauthlimit/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/sip/tcpauthlimit/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip/tcpauthlimit/test-config.yaml?view=auto&rev=1471
==============================================================================
--- asterisk/trunk/tests/sip/tcpauthlimit/test-config.yaml (added)
+++ asterisk/trunk/tests/sip/tcpauthlimit/test-config.yaml Thu Apr 21 16:41:52 2011
@@ -1,0 +1,17 @@
+testinfo:
+    summary:     'Test the tcpauthlimit sip config option.'
+    description: |
+        "This test ensures that chan_sip respects the tcpauthlimit config
+        option."
+    issues:
+        -mantis: 18996
+        -jira: SWP-3248
+
+properties:
+    minversion: '1.6.1'
+    dependencies:
+        - app : 'bash'
+        - app : 'asttest'
+        - sipp :
+            version : 'v3.0'
+

Propchange: asterisk/trunk/tests/sip/tcpauthlimit/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/sip/tcpauthlimit/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/sip/tcpauthlimit/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/sip/tcpauthlimit/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip/tcpauthlimit/test.lua?view=auto&rev=1471
==============================================================================
--- asterisk/trunk/tests/sip/tcpauthlimit/test.lua (added)
+++ asterisk/trunk/tests/sip/tcpauthlimit/test.lua Thu Apr 21 16:41:52 2011
@@ -1,0 +1,113 @@
+have_error = false
+function print_error(err)
+	print(err)
+	have_error = true
+end
+
+function sipp_exec(to, from)
+	return proc.exec_io("sipp",
+	to,
+	"-m", "1",
+	"-t", "t1",
+	"-sn", "uac",
+	"-d", 10000,      -- keep calls up for 10 seconds
+	"-i", from,
+	"-p", 5060,
+	"-timeout", "60",
+	"-timeout_error"
+	)
+end
+
+function sipp_check_error(p, index)
+	local res, err = p:wait()
+
+	if not res then
+		print_error(err)
+		return res, err
+	end
+	if res ~= 0 then
+		print_error("error while connecting client " .. index .. " (sipp exited with status " .. res .. ")\n" .. p.stderr:read("*a"))
+	end
+
+	return res, err
+end
+
+function connect(addr)
+	local sock, err = socket.tcp()
+	if not sock then
+		return nil, err
+	end
+
+	local res, err = sock:connect(addr, 5060)
+	if not res then
+		sock:close()
+		return nil, err
+	end
+
+	-- select then read from the sock to see if it is sill up
+	local read, _, err = socket.select({sock}, nil, 0.1)
+	if read[1] ~= sock and err ~= "timeout" then
+		return nil, err
+	end
+
+	-- if we have data, then there is probably a problem because chan_sip
+	-- doesn't send anything to new sockets
+	if read[1] == sock then
+		res, err = sock:receive(1);
+		if not res then
+			return nil, err
+		end
+	end
+
+	return sock
+end
+
+-- limit chan_sip to 5 connections
+limit = 5
+
+print("starting asterisk")
+a = ast.new()
+a["sip.conf"]["general"]["tcpauthlimit"] = limit
+a["sip.conf"]["general"]["tcpenable"] = "yes"
+sip_addr = "127.0.0." .. a.index
+a["sip.conf"]["general"]["tcpbindaddr"] = sip_addr
+
+a["extensions.conf"]["default"]["exten"] = "service,1,Answer"
+a["extensions.conf"]["default"]["exten"] = "service,n,Wait(60)"
+a:spawn()
+
+clients = {}
+
+print("connecting " .. limit .. " clients to asterisk")
+for i = 1, limit do
+	local sock = check("error connecting to chan_sip via TCP", connect(sip_addr))
+	table.insert(clients, sock)
+end
+
+print("attempting to connect one more, this should fail")
+fail_if(connect(sip_addr), "client " .. limit + 1 .. " successfully connected, this should have failed")
+
+for _, sock in ipairs(clients) do
+	sock:shutdown("both")
+	sock:close()
+end
+
+posix.sleep(3) -- let the connections shut down
+
+print("connecting and authenticating " .. limit * 2 .. " clients to asterisk")
+clients = {}
+for i = 1, limit * 2 do
+	table.insert(clients, sipp_exec(sip_addr, "127.0.0." .. a.index + i))
+
+	-- for some reason sipp opens two connections to asterisk when setting
+	-- up a call.  Pausing here gives time for one of them to go away.
+	posix.sleep(1)
+end
+
+print("checking for errors")
+for i, sipp in ipairs(clients) do
+	sipp_check_error(sipp, i)
+end
+
+fail_if(have_error, "one (or more) of our clients had a problem")
+

Propchange: asterisk/trunk/tests/sip/tcpauthlimit/test.lua
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/sip/tcpauthlimit/test.lua
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/sip/tcpauthlimit/test.lua
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/sip/tcpauthtimeout/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip/tcpauthtimeout/run-test?view=auto&rev=1471
==============================================================================
--- asterisk/trunk/tests/sip/tcpauthtimeout/run-test (added)
+++ asterisk/trunk/tests/sip/tcpauthtimeout/run-test Thu Apr 21 16:41:52 2011
@@ -1,0 +1,4 @@
+#!/usr/bin/env bash
+set -e
+. lib/sh/lua.sh
+asttest -a / -s `dirname $0` $@

Propchange: asterisk/trunk/tests/sip/tcpauthtimeout/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/sip/tcpauthtimeout/run-test
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/sip/tcpauthtimeout/run-test
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/sip/tcpauthtimeout/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/sip/tcpauthtimeout/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip/tcpauthtimeout/test-config.yaml?view=auto&rev=1471
==============================================================================
--- asterisk/trunk/tests/sip/tcpauthtimeout/test-config.yaml (added)
+++ asterisk/trunk/tests/sip/tcpauthtimeout/test-config.yaml Thu Apr 21 16:41:52 2011
@@ -1,0 +1,17 @@
+testinfo:
+    summary:     'Test the tcpauthtimeout sip config option.'
+    description: |
+        "This test ensures that chan_sip respects the tcpauthtimeout config
+        option."
+    issues:
+        -mantis: 18996
+        -jira: SWP-3248
+
+properties:
+    minversion: '1.6.1'
+    dependencies:
+        - app : 'bash'
+        - app : 'asttest'
+        - sipp :
+            version : 'v3.0'
+

Propchange: asterisk/trunk/tests/sip/tcpauthtimeout/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/sip/tcpauthtimeout/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/sip/tcpauthtimeout/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/sip/tcpauthtimeout/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip/tcpauthtimeout/test.lua?view=auto&rev=1471
==============================================================================
--- asterisk/trunk/tests/sip/tcpauthtimeout/test.lua (added)
+++ asterisk/trunk/tests/sip/tcpauthtimeout/test.lua Thu Apr 21 16:41:52 2011
@@ -1,0 +1,129 @@
+have_error = false
+function print_error(err)
+	print(err)
+	have_error = true
+end
+
+function sipp_exec(to, from)
+	return proc.exec_io("sipp",
+	to,
+	"-m", "1",
+	"-t", "t1",
+	"-sn", "uac",
+	"-d", timeout * 2,   -- keep calls up longer than the timeout
+	"-i", from,
+	"-p", 5060,
+	"-timeout", "60",
+	"-timeout_error"
+	)
+end
+
+function sipp_check_error(p, index)
+	local res, err = p:wait()
+
+	if not res then
+		print_error(err)
+		return res, err
+	end
+	if res ~= 0 then
+		print_error("error while connecting client " .. index .. " (sipp exited with status " .. res .. ")\n" .. p.stderr:read("*a"))
+	end
+
+	return res, err
+end
+
+function connect(addr)
+	local sock, err = socket.tcp()
+	if not sock then
+		return nil, err
+	end
+
+	local res, err = sock:connect(addr, 5060)
+	if not res then
+		sock:close()
+		return nil, err
+	end
+
+	return check_sock(sock)
+end
+
+function check_sock(sock)
+	-- select then read from the sock to see if it is still up
+	local read, _, err = socket.select({sock}, nil, 0.1)
+	if read[1] ~= sock and err ~= "timeout" then
+		return nil, err
+	end
+
+	-- if we have data, then there is probably a problem because chan_sip
+	-- doesn't send anything to new sockets
+	if read[1] == sock then
+		local res, err = sock:receive(1);
+		if not res then
+			return nil, err
+		end
+	end
+
+	return sock
+end
+
+function write_sock(sock, data)
+	local res, err, i = nil, nil, 0
+
+	while i < #data do
+		res, err, i = sock:send(data, i)
+		if err then
+			return nil, err
+		else
+			i = res
+		end
+	end
+	return true
+end
+
+-- timeout connections after 5 seconds
+timeout = 5
+
+print("starting asterisk")
+a = ast.new()
+a["sip.conf"]["general"]["tcpauthtimeout"] = timeout
+a["sip.conf"]["general"]["tcpenable"] = "yes"
+sip_addr = "127.0.0." .. a.index
+sip_port = "5060"
+a["sip.conf"]["general"]["tcpbindaddr"] = sip_addr .. ":" .. sip_port
+
+a["extensions.conf"]["default"]["exten"] = "service,1,Answer"
+a["extensions.conf"]["default"]["exten"] = "service,n,Wait(60)"
+a:spawn()
+
+print("testing timeout of an unauthenticated session")
+sock = check("error connecting to asterisk via TCP", connect(sip_addr))
+posix.sleep(timeout + 1);
+fail_if(check_sock(sock), "asterisk did not close the connection after " .. timeout .. " seconds")
+
+print("testing timeout of an unauthenticated session after writing some data")
+sock = check("error connecting to asterisk via TCP", connect(sip_addr))
+check("error writing data to the socket", write_sock(sock, "hi, this is your tester standby"))
+posix.sleep(timeout + 1);
+fail_if(check_sock(sock), "asterisk did not close the connection after " .. timeout .. " seconds")
+
+print("testing timeout of an unauthenticated session after writing some different data")
+sock = check("error connecting to asterisk via TCP", connect(sip_addr))
+check("error writing data to the socket", write_sock(sock, "INVITE sip:service at 127.0.0.1:5060 SIP/2.0\r\n"))
+posix.sleep(timeout + 1);
+fail_if(check_sock(sock), "asterisk did not close the connection after " .. timeout .. " seconds")
+
+print("testing timeout of an unauthenticated session after writing data in bursts")
+sock = check("error connecting to asterisk via TCP", connect(sip_addr))
+check("error writing data to the socket", write_sock(sock, "hi, this is your tester standby\r\n"))
+posix.sleep(1)
+check("error writing data to the socket", write_sock(sock, "hi, this is your tester, again... standby"))
+posix.sleep(1)
+check("error writing data to the socket", write_sock(sock, "guess who?! yup, your tester... standby\r\n"))
+posix.sleep(timeout);
+fail_if(check_sock(sock), "asterisk did not close the connection after " .. timeout .. " seconds")
+
+print("testing timeout of an authenticated session (should not timeout)")
+sipp = sipp_exec(sip_addr, "127.0.0." .. a.index + 1)
+sipp_check_error(sipp, 1)
+fail_if(have_error, "our authenticated client a problem")
+

Propchange: asterisk/trunk/tests/sip/tcpauthtimeout/test.lua
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/sip/tcpauthtimeout/test.lua
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/sip/tcpauthtimeout/test.lua
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/sip/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip/tests.yaml?view=diff&rev=1471&r1=1470&r2=1471
==============================================================================
--- asterisk/trunk/tests/sip/tests.yaml (original)
+++ asterisk/trunk/tests/sip/tests.yaml Thu Apr 21 16:41:52 2011
@@ -4,3 +4,5 @@
     #- test: 'handle_response_refer'
     - test: 'options'
     - test: 'refer_replaces_to_self'
+    - test: 'tcpauthlimit'
+    - test: 'tcpauthtimeout'




More information about the asterisk-commits mailing list