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";
10
use warnings FATAL => 'all';
11
use English qw(-no_match_vars);
16
require "$trunk/bin/pt-table-sync";
19
my $dp = new DSNParser(opts=>$dsn_opts);
20
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
21
my $master_dbh = $sb->get_dbh_for('master');
23
diag(`$trunk/sandbox/start-sandbox master 12347 >/dev/null`);
24
my $dbh2 = $sb->get_dbh_for('slave2');
27
plan skip_all => 'Cannot connect to sandbox master';
30
plan skip_all => 'Cannot connect to second sandbox master';
36
$sb->wipe_clean($master_dbh);
37
$sb->create_dbs($master_dbh, [qw(test)]);
39
# Need at least 1 table so the db will be used.
40
$master_dbh->do('create table test.foo (i int)');
42
# #############################################################################
43
# Issue 408: DBD::mysql::st execute failed: Unknown database 'd1' at
44
# ./mk-table-sync line 2015.
45
# #############################################################################
47
$output = `$trunk/bin/pt-table-sync --databases test --execute h=127.1,P=12345,u=msandbox,p=msandbox h=127.1,P=12347 2>&1`;
50
qr/Unknown database 'test'/,
51
'Warn about --databases missing on dest host'
54
# #############################################################################
56
# #############################################################################
57
$sb->wipe_clean($master_dbh);
58
diag(`/tmp/12347/stop >/dev/null`);
59
diag(`rm -rf /tmp/12347 >/dev/null`);