Sha256: 7c36b5d8c17fa9cf5b8d67f85ebcd18f61830ce945ff8fd10907e629273fcaa5

Contents?: true

Size: 767 Bytes

Versions: 25

Compression:

Stored size: 767 Bytes

Contents

require "cases/helper"

class MysqlConnectionTest < ActiveRecord::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

Version data entries

25 entries across 25 versions & 7 rubygems

Version Path
activerecord-2.1.1 test/cases/connection_test_mysql.rb
antfarm-0.3.0 rails/vendor/rails/activerecord/test/cases/connection_test_mysql.rb
antfarm-0.4.0 rails/vendor/rails/activerecord/test/cases/connection_test_mysql.rb
radiant-0.7.0 vendor/rails/activerecord/test/cases/connection_test_mysql.rb
radiant-0.7.1 vendor/rails/activerecord/test/cases/connection_test_mysql.rb