mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-26 05:58:16 +00:00
Merged fix-1022622-ptcd-case-sensitivity
This commit is contained in:
@@ -392,6 +392,39 @@ $c2 = new MySQLConfig(
|
||||
"Values are the same regardless of quoting"
|
||||
) or diag(Dumper($diff));
|
||||
}
|
||||
# #############################################################################
|
||||
# Case insensitivity
|
||||
# #############################################################################
|
||||
|
||||
$c1 = new MySQLConfig(
|
||||
result_set => [['binlog_format', 'MIXED']],
|
||||
format => 'option_file',
|
||||
);
|
||||
|
||||
$c2 = new MySQLConfig(
|
||||
result_set => [['binlog_format', 'mixed']],
|
||||
format => 'option_file',
|
||||
);
|
||||
|
||||
is_deeply(
|
||||
diff($c1, $c2),
|
||||
undef,
|
||||
"Case insensitivity is on by default"
|
||||
);
|
||||
|
||||
my $case_cc = MySQLConfigComparer->new( ignore_case => undef, );
|
||||
|
||||
is_deeply(
|
||||
$case_cc->diff(configs => [$c1, $c2]),
|
||||
{
|
||||
binlog_format => [
|
||||
'MIXED',
|
||||
'mixed'
|
||||
]
|
||||
},
|
||||
"..but can be turned off"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
@@ -26,11 +26,9 @@ if ( !$master_dbh ) {
|
||||
elsif ( !$slave_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox slave';
|
||||
}
|
||||
else {
|
||||
plan tests => 13;
|
||||
}
|
||||
|
||||
my $cnf = '/tmp/12345/my.sandbox.cnf';
|
||||
my $samples = "$trunk/t/pt-config-diff/samples/";
|
||||
my $output;
|
||||
my $retval;
|
||||
|
||||
@@ -162,8 +160,44 @@ like(
|
||||
"Config diff output"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Case insensitivity
|
||||
# #############################################################################
|
||||
|
||||
use File::Spec;
|
||||
|
||||
$output = output(
|
||||
sub { $retval = pt_config_diff::main(
|
||||
File::Spec->catfile($samples, "case1.cnf"),
|
||||
File::Spec->catfile($samples, "case2.cnf"),
|
||||
) },
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
is(
|
||||
$output,
|
||||
"",
|
||||
"Case-insensitive by default, finds no diffs"
|
||||
);
|
||||
|
||||
$output = output(
|
||||
sub { $retval = pt_config_diff::main(
|
||||
File::Spec->catfile($samples, "case1.cnf"),
|
||||
File::Spec->catfile($samples, "case2.cnf"),
|
||||
'--no-ignore-case',
|
||||
) },
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/binlog_format\s+genlog\s+GENLOG/,
|
||||
"With case-insensitivity turned off, finds one diff"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
exit;
|
||||
|
||||
done_testing;
|
||||
|
Reference in New Issue
Block a user