diff --git a/test/connect_failure2_test.rb b/test/connect_failure2_test.rb index c792bdc..98fd476 100644 --- a/test/connect_failure2_test.rb +++ b/test/connect_failure2_test.rb @@ -1,16 +1,17 @@ if RUBY_VERSION >= "1.9.1" require 'mysqlplus' require 'socket' - TCPServer.new '0.0.0.0', 8001 + TCPServer.new '0.0.0.0', 8002 require 'timeout' + Thread.new { + sleep 2 + print "pass" + system("kill -9 #{Process.pid}") + } Timeout::timeout(1) { # uncomment this line to do the 'real' test # which hangs otherwise (blows up if code is bad, otherwise hangs) - # Mysql.real_connect '127.0.0.1', 'root', 'pass', 'db', 8000 + Mysql.real_connect '127.0.0.1', 'root', 'pass', 'db', 8002 } - Thread.new { Mysql.real_connect '127.0.0.1', 'root', 'pass', 'db', 8001 } - sleep 1 - print "pass" - system("kill -9 #{Process.pid}") end