Sha256: 0fff33dac9ff262858b67e25aeab16bd6faf2c1e5499ff0f7e3a5c3ab3d469d8

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../test_helper")

class TestHandler
  include MysqlReplicationHelper::ErrorHandler
end

class MysqlReplicationHelper::ErrorHandlerTest < Test::Unit::TestCase
  def test_responses
    handler = TestHandler.new
    
    [
      [
        "Error 'Unknown database 'example_db'' on query. Default database: 'example_db'.",
        [ "CREATE DATABASE `example_db`", "START SLAVE" ]
      ],
      [
        "Error 'There is no 'example_user'@'example_host' registered' on query. Default database: 'example_db'.",
        [ "CREATE USER `example_user`@`example_host`", "GRANT ALL PRIVILEGES ON `example_db`.* TO `example_user`@`example_host`", "START SLAVE" ]
      ],
      [
        "Error 'View 'example_db.example_table' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them' on query. Default database: 'example_db'. Query: 'CREATE ALGORITHM=UNDEFINED DEFINER=`example_user`@`example_host` SQL SECURITY DEFINER VIEW",
        [ "GRANT ALL PRIVILEGES ON `example_db`.* TO `example_user`@`example_host`", "START SLAVE" ]
      ]
    ].each do |test_case|
      assert_equal test_case[1], handler.sql_to_recover_from(test_case[0])
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
theworkinggroup-mysql-replication-helper-0.1.0 test/mysql_replication_helper/error_handler_test.rb
theworkinggroup-mysql-replication-helper-0.2.0 test/mysql_replication_helper/error_handler_test.rb
mysql-replication-helper-0.2.1 test/mysql_replication_helper/error_handler_test.rb