Skip to content

Commit e5fbf05

Browse files
committed
Fix an error message test in error_spec.rb on MariaDB 10.5.
MariaDB 10.5 returns a little different error message unlike MySQL and other old MariaDBs. https://jira.mariadb.org/browse/MDEV-25400 .
1 parent b85b6bb commit e5fbf05

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

spec/mysql2/error_spec.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
end
4040
end
4141

42+
let(:server_info) do
43+
@client.server_info
44+
end
45+
4246
before do
4347
# sanity check
4448
expect(valid_utf8.encoding).to eql(Encoding::UTF_8)
@@ -56,7 +60,15 @@
5660
expect(bad_err.message.encoding).to eql(Encoding::UTF_8)
5761
expect(bad_err.message).to be_valid_encoding
5862

59-
expect(bad_err.message).to include("??}\u001F")
63+
# MariaDB 10.5 returns a little different error message unlike MySQL
64+
# and other old MariaDBs.
65+
# https://jira.mariadb.org/browse/MDEV-25400
66+
err_str = if server_info[:version].match(/MariaDB/) && server_info[:id] >= 100500
67+
"??}\\001F"
68+
else
69+
"??}\u001F"
70+
end
71+
expect(bad_err.message).to include(err_str)
6072
end
6173
end
6274

0 commit comments

Comments
 (0)