Updates to run tests with activerecord 7.1 #2359
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When running the oracle enhanced tests with activerecord v7.1.0 or above I get:
Line 24 in the rakefile that is causing the problem is
ActiveRecord::Base.connection.execute_structure_dump(ActiveRecord::Base.connection.full_drop)
. This appears to be related to the changes in rails/rails#44576 and rails/rails#44591. We no longer have a@raw_connection
after callingActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
on line 22, so trying work withActiveRecord::Base.connection
gives us the nil error.3a288c3 addresses the error in starting the tests by:
get_database_version
to usevalid_raw_connection
which will connect if necessaryself.lock_thread = nil
before the call tosuper
inOracleEnhancedAdapter#initialize
. In super they assign a visitor beforeself.lock_thread = nil
. In oracle enhanced assigning a visitor requires a check ofdatabase_version
, which with the new use ofvalid_raw_connection
requires@lock
to be set first.After those changes, the test start, although with many errors. A couple of the more immediate ones are addressed here as well:
internal_exec_query
that is called by the abstract adapter'sexec_query
. Renaming oracle_enhanced'sexec_query
tointernal_exec_query
to address thisactive?
because@raw_connection
is nil. Usingvalid_raw_connection
inactive?
results in a stack level too deep, so I adapted he postgres adapter's implementation.