Skip to content

Commit 22bcead

Browse files
committed
Address ApplicationTests::FrameworksTest failure on Ubuntu 22.04
This commit address Rails Nightly failure at https://buildkite.com/rails/rails-nightly/builds/191#018dc3d1-8fb2-4c35-ad1d-bd3891757361/1310-1318 This issue reproduces when the `default-mysql-client` apt package installs `mysql-client-8.0` that raises `CR_CONN_HOST_ERROR` which is mapped to `ActiveRecord::DatabaseConnectionError` while `mariadb-client` raises `CR_CONNECTION_ERROR` error which is mapped to `ActiveRecord::ConnectionNotEstablished`. In this test, whichever exception `ActiveRecord::ConnectionNotEstablished` or `DatabaseConnectionError` is fine as long as the connection is invalid. - Steps to reproduce Run this step at Linux box on Ubuntu Jammy or whatever `default-mysql-client` installs MySQL client, not MariaDB one. ``` git clone https://github.com/rails/rails cd rails/railties bundle install bin/test test/application/initializers/frameworks_test.rb:285 ``` - Failure fixed by this commit ```ruby $ bin/test test/application/initializers/frameworks_test.rb:285 Run options: --seed 32832 F Failure: ApplicationTests::FrameworksTest#test_expire_schema_cache_dump_if_the_version_can't_be_checked_because_the_database_is_unhealthy [test/application/initializers/frameworks_test.rb:285]: Expected /Failed to validate the schema cache because of ActiveRecord::ConnectionNotEstablished/ to match "Failed to validate the schema cache because of ActiveRecord::DatabaseConnectionError: There is an issue connecting with your hostname: 127.0.0.1.\n\nPlease check your database configuration and ensure there is a valid connection to your database.\n". bin/test test/application/initializers/frameworks_test.rb:263 Finished in 6.299418s, 0.1587 runs/s, 0.6350 assertions/s. 1 runs, 4 assertions, 1 failures, 0 errors, 0 skips ``` - `default-mysql-client` package used by Rails CI https://github.com/rails/buildkite-config/blob/3158d00b48da5a30f4319af1f7ac73f2b7094898/Dockerfile#L91 `default-mysql-client` installs different package per distribution, Ja https://packages.ubuntu.com/jammy/default-mysql-client https://packages.debian.org/bookworm/default-mysql-client - Each error message are defined in these lines by these commits: -- MariaDB https://github.com/MariaDB/server/blob/eeba940311ed17d160023280783fd2bbb64abef3/sql-common/errmsg.c#L32 MariaDB/server@9075973 -- MySQL https://github.com/mysql/mysql-server/blob/824e2b4064053f7daf17d7f3f84b7a3ed92e5fb4/libmysql/errmsg.cc#L39 mysql/mysql-server@964d5fd
1 parent 554e71a commit 22bcead

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

railties/test/application/initializers/frameworks_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def show
282282
end
283283
end
284284

285-
assert_match(/Failed to validate the schema cache because of ActiveRecord::ConnectionNotEstablished/, error)
285+
assert_match(/Failed to validate the schema cache because of ActiveRecord::(ConnectionNotEstablished|DatabaseConnectionError)/, error)
286286
end
287287
end
288288
end

0 commit comments

Comments
 (0)