mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Rename to test_mysql_strict_mode_disabled_dont_override_global_sql_mode
Reason since MySQL 5.6.6-m9 the `sql_mode` default value is `NO_ENGINE_SUBSTITUTION`. This default parameter change is out of control from Rails. This test verifies Rails not overriding the default `@@GLOBAL.sql_mode` value by checking if `@@GLOBAL.sql_mode` is the same as `@@SESSION.sql_mode`.
This commit is contained in:
parent
7e68e8bcc7
commit
babc24c1b0
2 changed files with 8 additions and 6 deletions
|
@ -128,11 +128,12 @@ class MysqlConnectionTest < ActiveRecord::TestCase
|
|||
assert_equal [["STRICT_ALL_TABLES"]], result.rows
|
||||
end
|
||||
|
||||
def test_mysql_strict_mode_disabled
|
||||
def test_mysql_strict_mode_disabled_dont_override_global_sql_mode
|
||||
run_without_connection do |orig_connection|
|
||||
ActiveRecord::Model.establish_connection(orig_connection.merge({:strict => false}))
|
||||
result = ActiveRecord::Model.connection.exec_query "SELECT @@SESSION.sql_mode"
|
||||
assert_equal [['']], result.rows
|
||||
global_sql_mode = ActiveRecord::Model.connection.exec_query "SELECT @@GLOBAL.sql_mode"
|
||||
session_sql_mode = ActiveRecord::Model.connection.exec_query "SELECT @@SESSION.sql_mode"
|
||||
assert_equal global_sql_mode.rows, session_sql_mode.rows
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -44,11 +44,12 @@ class MysqlConnectionTest < ActiveRecord::TestCase
|
|||
assert_equal [["STRICT_ALL_TABLES"]], result.rows
|
||||
end
|
||||
|
||||
def test_mysql_strict_mode_disabled
|
||||
def test_mysql_strict_mode_disabled_dont_override_global_sql_mode
|
||||
run_without_connection do |orig_connection|
|
||||
ActiveRecord::Model.establish_connection(orig_connection.merge({:strict => false}))
|
||||
result = ActiveRecord::Model.connection.exec_query "SELECT @@SESSION.sql_mode"
|
||||
assert_equal [['']], result.rows
|
||||
global_sql_mode = ActiveRecord::Model.connection.exec_query "SELECT @@GLOBAL.sql_mode"
|
||||
session_sql_mode = ActiveRecord::Model.connection.exec_query "SELECT @@SESSION.sql_mode"
|
||||
assert_equal global_sql_mode.rows, session_sql_mode.rows
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue