Sha256: 2953bd9907bee82fcf709701734e42aeecf47e56213d3734e1bcac4f9cf3cd21

Contents?: true

Size: 828 Bytes

Versions: 4

Compression:

Stored size: 828 Bytes

Contents

require_relative "../integration_helper"
class WithKillableQueries < Minitest::Test
  def test_with_queries_to_be_killed
    puts "testing with long running queries..."

    $mysql_master.connection.query("set GLOBAL READ_ONLY=0")
    $mysql_slave.connection.query("set GLOBAL READ_ONLY=1")

    thread = Thread.new {
      begin
        $mysql_master.connection.query("update flexmaster_test.users set name=sleep(600)")
        assert false, "Query did not get killed!  Bad."
        exit 1
      rescue Exception => e
        puts e
      end
    }

    system "#{master_cut_script} 127.0.0.1:#{$mysql_master.port} 127.0.0.1:#{$mysql_slave.port} root -p ''"

    thread.join

    $mysql_master.reconnect!
    assert_ro($mysql_master.connection, 'master', true)
    assert_ro($mysql_slave.connection, 'slave', false)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ar_mysql_flexmaster-1.0.1 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-1.0.0 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.6.0 test/integration/with_queries_to_be_killed_test.rb
ar_mysql_flexmaster-0.5.0 test/integration/with_queries_to_be_killed_test.rb