Rename to test_mysql_no_override_global_sql_mode #7408

Merged
merged 1 commit into from Aug 21, 2012

2 participants

@yahonda

This pull request addresses two failures tested with MySQL 5.6.6 m9 (milestone 9).

$ mysql --version
mysql  Ver 14.14 Distrib 5.6.6-m9, for Linux (x86_64) using  EditLine wrapper
  • Failure with mysql adapter
$ rake test_mysql

... snip ...
Finished tests in 199.465809s, 17.8427 tests/s, 52.2947 assertions/s.

  1) Failure:
test_mysql_strict_mode_disabled(MysqlConnectionTest) [/home/yahonda/git/rails/activerecord/test/cases/adapters/mysql/connection_test.rb:135]:
Expected: [[""]]
  Actual: [["NO_ENGINE_SUBSTITUTION"]]

3559 tests, 10431 assertions, 1 failures, 0 errors, 6 skips
rake aborted!
Command failed with status (1): [/home/yahonda/.rvm/rubies/ruby-1.9.3-p194/...]

Tasks: TOP => test_mysql
(See full trace by running task with --trace)
$ 
  • Failure with mysql2 adapter
$ rake test_mysql2

... snip ...
Finished tests in 166.461722s, 21.3683 tests/s, 62.6330 assertions/s.

1) Failure:
test_mysql_strict_mode_disabled(MysqlConnectionTest) [/home/yahonda/git/rails/activerecord/test/cases/adapters/mysql2/connection_test.rb:51]:
Expected: [[""]]
Actual: [["NO_ENGINE_SUBSTITUTION"]]

3557 tests, 10426 assertions, 1 failures, 0 errors, 18 skips
rake aborted!
Command failed with status (1): [/home/yahonda/.rvm/rubies/ruby-1.9.3-p194/...]

Tasks: TOP => test_mysql2
(See full trace by running task with --trace)
$
  • sql_mode default value as of MySQL 5.6.6 m9.

It might have caused sql_mode default value as of MySQL 5.6.6 m9 is NO_ENGINE_SUBSTITUTION, which was empty at older versions.

mysql> select @@global.sql_mode;
+------------------------+
| @@global.sql_mode      |
+------------------------+
| NO_ENGINE_SUBSTITUTION |
+------------------------+
1 row in set (0.00 sec)

mysql> select @@session.sql_mode;
+------------------------+
| @@session.sql_mode     |
+------------------------+
| NO_ENGINE_SUBSTITUTION |
+------------------------+
1 row in set (0.00 sec)

mysql> quit

This default parameter change is out of control from Rails, then these test verify Rails not overriding the default @@GLOBAL.sql_mode value by checking if @@GLOBAL.sql_mode is the same as @@SESSION.sql_mode.

@carlosantoniodasilva carlosantoniodasilva and 1 other commented on an outdated diff Aug 21, 2012
...erecord/test/cases/adapters/mysql2/connection_test.rb
@@ -44,11 +44,12 @@ def test_mysql_default_in_strict_mode
assert_equal [["STRICT_ALL_TABLES"]], result.rows
end
- def test_mysql_strict_mode_disabled
+ def test_mysql_no_override_global_sql_mode
@carlosantoniodasilva
Ruby on Rails member

Perhaps the test names could still have the strict_mode_disabled in them? Seems like it's what's being under test, not? How about:

test_mysql_strict_mode_disabled_dont_override_global_sql_mode

Or something like that?

@yahonda
yahonda added a line comment Aug 21, 2012

Thanks for the comment.
I was thinking what is the proper test name if MySQL default sql_mode would be changed to STRICT_ALL_TABLES. but it may be too much worrying about future.

I like your idea. test_mysql_strict_mode_disabled_dont_override_global_sql_mode shows its purpose correctly. I'll update my commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@yahonda yahonda 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`.
babc24c
@carlosantoniodasilva carlosantoniodasilva merged commit 8c600e4 into rails:master Aug 21, 2012
@carlosantoniodasilva
Ruby on Rails member

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment