Skip to content

Commit

Permalink
Fix an error message test in error_spec.rb on MariaDB 10.5.
Browse files Browse the repository at this point in the history
MariaDB 10.5 returns a little different error message unlike MySQL
and other old MariaDBs.
https://jira.mariadb.org/browse/MDEV-25400 .
  • Loading branch information
junaruga committed Apr 16, 2021
1 parent b85b6bb commit e5fbf05
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion spec/mysql2/error_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
end
end

let(:server_info) do
@client.server_info
end

before do
# sanity check
expect(valid_utf8.encoding).to eql(Encoding::UTF_8)
Expand All @@ -56,7 +60,15 @@
expect(bad_err.message.encoding).to eql(Encoding::UTF_8)
expect(bad_err.message).to be_valid_encoding

expect(bad_err.message).to include("??}\u001F")
# MariaDB 10.5 returns a little different error message unlike MySQL
# and other old MariaDBs.
# https://jira.mariadb.org/browse/MDEV-25400
err_str = if server_info[:version].match(/MariaDB/) && server_info[:id] >= 100500
"??}\\001F"
else
"??}\u001F"
end
expect(bad_err.message).to include(err_str)
end
end

Expand Down

0 comments on commit e5fbf05

Please sign in to comment.