~percona-toolkit-dev/percona-toolkit/fix-fingerprint-bug-1174956

« back to all changes in this revision

Viewing changes to t/pt-table-checksum/settings.t

Merge fix-ptc-ts-col-bug-1163735.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env perl
 
2
 
 
3
BEGIN {
 
4
   die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
 
5
      unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
 
6
   unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
 
7
};
 
8
 
 
9
use strict;
 
10
use warnings FATAL => 'all';
 
11
use English qw(-no_match_vars);
 
12
use Test::More;
 
13
 
 
14
use PerconaTest;
 
15
use Sandbox;
 
16
require "$trunk/bin/pt-table-checksum";
 
17
 
 
18
if ( $sandbox_version lt '5.6' ) {
 
19
   plan skip_all => 'Tests for MySQL 5.6';
 
20
}
 
21
 
 
22
diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);
 
23
diag(`EXTRA_DEFAULTS_FILE="$trunk/t/pt-table-checksum/samples/explicit_defaults_for_timestamp.cnf" $trunk/sandbox/start-sandbox master 12348 >/dev/null`);
 
24
 
 
25
my $dp = new DSNParser(opts=>$dsn_opts);
 
26
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
 
27
my $master_dbh = $sb->get_dbh_for('master1');
 
28
 
 
29
if ( !$master_dbh ) {
 
30
   plan skip_all => 'Cannot connect to sandbox master 12348';
 
31
}
 
32
 
 
33
my $master_dsn = 'h=127.1,P=12348,u=msandbox,p=msandbox';
 
34
my @args       = ($master_dsn, '--max-load', ''); 
 
35
my $output;
 
36
my $retval;
 
37
 
 
38
$output = output(
 
39
   sub { $retval = pt_table_checksum::main(@args, qw(-t mysql.user)) },
 
40
   stderr => 1,
 
41
);
 
42
 
 
43
unlike(
 
44
   $output,
 
45
   qr/error 1364/i,
 
46
   "explicit_defaults_for_timestamp (bug 1163735): no error"
 
47
);
 
48
 
 
49
# Exit will be non-zero because of "Diffs cannot be detected because
 
50
# no slaves were found."
 
51
 
 
52
# #############################################################################
 
53
# Done.
 
54
# #############################################################################
 
55
diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);
 
56
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
 
57
done_testing;