Skip to content

Commit b85b6bb

Browse files
committed
Skip tests using performance_schema if the it is not enabled.
Fix the test failures in client_spec.rb on MariaDB. On MariaDB >= 10.0, the setting of the peformance schema is disabled by defult. https://jira.mariadb.org/browse/MDEV-6726 You can comfirm the status by the SQL `SHOW VARIABLES LIKE 'performance_schema`.
1 parent f86514a commit b85b6bb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

spec/mysql2/client_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
require 'spec_helper'
22

33
RSpec.describe Mysql2::Client do # rubocop:disable Metrics/BlockLength
4+
let(:performance_schema_enabled) do
5+
performance_schema = @client.query "SHOW VARIABLES LIKE 'performance_schema'"
6+
performance_schema.any? { |x| x['Value'] == 'ON' }
7+
end
8+
49
context "using defaults file" do
510
let(:cnf_file) { File.expand_path('../../my.cnf', __FILE__) }
611

@@ -479,6 +484,7 @@ def run_gc
479484
end
480485

481486
it "should set default program_name in connect_attrs" do
487+
skip("DON'T WORRY, THIS TEST PASSES - but PERFORMNCE SCHEMA is not enabled in your MySQL daemon.") unless performance_schema_enabled
482488
client = new_client
483489
if Mysql2::Client::CONNECT_ATTRS.zero? || client.server_info[:version].match(/10.[01].\d+-MariaDB/)
484490
pending('Both client and server versions must be MySQL 5.6 or MariaDB 10.2 or later.')
@@ -488,6 +494,7 @@ def run_gc
488494
end
489495

490496
it "should set custom connect_attrs" do
497+
skip("DON'T WORRY, THIS TEST PASSES - but PERFORMNCE SCHEMA is not enabled in your MySQL daemon.") unless performance_schema_enabled
491498
client = new_client(connect_attrs: { program_name: 'my_program_name', foo: 'fooval', bar: 'barval' })
492499
if Mysql2::Client::CONNECT_ATTRS.zero? || client.server_info[:version].match(/10.[01].\d+-MariaDB/)
493500
pending('Both client and server versions must be MySQL 5.6 or MariaDB 10.2 or later.')

0 commit comments

Comments
 (0)