From e5fbf05b6c67d34977b09590e6c6145fe634da60 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Fri, 16 Apr 2021 16:04:46 +0200 Subject: [PATCH] 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 . --- spec/mysql2/error_spec.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/spec/mysql2/error_spec.rb b/spec/mysql2/error_spec.rb index c94a31961..efa3437f8 100644 --- a/spec/mysql2/error_spec.rb +++ b/spec/mysql2/error_spec.rb @@ -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) @@ -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