add an assertion for the out_of_sync_test

This commit is contained in:
Roger Pack 2009-04-18 22:42:12 +00:00
parent 0fa6f9f30f
commit 0f14fb920c

View File

@ -2,13 +2,13 @@ require File.dirname(__FILE__) + '/test_helper'
m = Mysql.real_connect('localhost','root') m = Mysql.real_connect('localhost','root')
m.reconnect = true m.reconnect = true
$count = 0
class << m class << m
def safe_query( query ) def safe_query( query )
begin begin
send_query( query ) send_query( query )
rescue => e rescue => e
$count += 1
puts e.message puts e.message
end end
end end
@ -25,7 +25,10 @@ m.connect('localhost','root')
m.safe_query( 'select sleep(1)' ) m.safe_query( 'select sleep(1)' )
m.safe_query( 'select sleep(1)' )#raises m.safe_query( 'select sleep(1)' )#raises
m.simulate_disconnect m.simulate_disconnect
raise unless $count == 3
m.safe_query( 'BEGIN' ) m.safe_query( 'BEGIN' )
m.safe_query( 'select sleep(1)' ) m.safe_query( 'select sleep(1)' ) # raises
m.get_result() m.get_result()
m.safe_query( 'COMMIT' ) m.safe_query( 'COMMIT' )
m.get_result
raise unless $count == 4