diff options
Diffstat (limited to 'activerecord/test/connection_test_mysql.rb')
-rw-r--r-- | activerecord/test/connection_test_mysql.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/activerecord/test/connection_test_mysql.rb b/activerecord/test/connection_test_mysql.rb new file mode 100644 index 0000000000..e3f589c4af --- /dev/null +++ b/activerecord/test/connection_test_mysql.rb @@ -0,0 +1,30 @@ +require "#{File.dirname(__FILE__)}/abstract_unit" + +class MysqlConnectionTest < Test::Unit::TestCase + def setup + @connection = ActiveRecord::Base.connection + end + + def test_no_automatic_reconnection_after_timeout + assert @connection.active? + @connection.update('set @@wait_timeout=1') + sleep 2 + assert !@connection.active? + end + + def test_successful_reconnection_after_timeout_with_manual_reconnect + assert @connection.active? + @connection.update('set @@wait_timeout=1') + sleep 2 + @connection.reconnect! + assert @connection.active? + end + + def test_successful_reconnection_after_timeout_with_verify + assert @connection.active? + @connection.update('set @@wait_timeout=1') + sleep 2 + @connection.verify!(0) + assert @connection.active? + end +end |