Remove warning from MySQL test run. #14223

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants
Contributor

patricksrobertson commented Feb 27, 2014

Short circuit the Mysql::ConnectionAdapter#error_number to return early if the error is
one in which there is no connection. This removes a warning from the test suite run.

@patricksrobertson patricksrobertson Remove warning from MySQL test run.
Short circuit the Mysql::ConnectionAdapter#error_number to return early if the error is
one in which there is no connection. This removes a warning from the test suite run.
7b2e24a

@arthurnn arthurnn commented on the diff Feb 28, 2014

...ib/active_record/connection_adapters/mysql_adapter.rb
@@ -161,6 +161,7 @@ def new_column(field, default, type, null, collation, extra = "") # :nodoc:
end
def error_number(exception) # :nodoc:
+ return if exception.respond_to?(:error) && exception.error == "query: not connected"
@arthurnn

arthurnn Feb 28, 2014

Member

not sure about this. How about if the error string changes, this code will be here still without anyone noticing.

@patricksrobertson

patricksrobertson Mar 1, 2014

Contributor

The mysql adapter isn't undergoing active development -- only bug fixes. I think it is pretty safe to assume this error condition is stable. It would be much less safe for mysql2

Member

senny commented Jun 24, 2014

I don't think we should add such specific production code to remove a warning in our tests. Even more so if we have to rely on string comparisons.

/cc @rafaelfranca

senny closed this Jun 24, 2014

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