create an automated test, somewhat automated it seems impossible to actually interrupt mysql real_connect
This commit is contained in:
parent
d1433a549e
commit
d40d8ff323
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user