Fixed tests for pt-stalk

This commit is contained in:
Carlos Salguero
2017-04-13 11:41:08 -03:00
parent cb44ba412f
commit a7ffe2e032
2 changed files with 58 additions and 39 deletions

View File

@@ -246,7 +246,6 @@ else
fi
APP="${FORK:-"mysql"}"
echo "APP $APP" > /home/karl/k
if [ $type = "cluster" -o $APP = "pxc" ]; then
# disabled for now because used perl module is not available everywhere and in some distros it returns ipv6 address
@@ -256,7 +255,6 @@ if [ $type = "cluster" -o $APP = "pxc" ]; then
else
version=`$PERCONA_TOOLKIT_SANDBOX/$mysqld -V 2>/dev/null | awk '{print $3}' | cut -d. -f 1,2`;
fi
echo "version $version" >> /home/karl/k
if [ ! -d "$PERCONA_TOOLKIT_BRANCH/sandbox/servers/${APP#mysql}/$version" ]; then
die "$PERCONA_TOOLKIT_BRANCH/sandbox/servers/${APP#mysql}/$version does not exist."

View File

@@ -465,28 +465,58 @@ SKIP: {
qr/ STATE: COMMITTED/,
"MySQL 5.7 COMMITTED transactions"
);
cleanup();
}
cleanup();
SKIP: {
my ($master1_dbh, $master1_dsn) = $sb->start_sandbox(
skip "Only test on mysql 5.7" if ( $sandbox_version lt '5.7' );
my ($master1_dbh, $master1_dsn) = $sb->start_sandbox(
server => 'chan_master1',
type => 'master',
);
my ($master2_dbh, $master2_dsn) = $sb->start_sandbox(
);
my ($master2_dbh, $master2_dsn) = $sb->start_sandbox(
server => 'chan_master2',
type => 'master',
);
my ($slave1_dbh, $slave1_dsn) = $sb->start_sandbox(
);
my ($slave1_dbh, $slave1_dsn) = $sb->start_sandbox(
server => 'chan_slave1',
type => 'master',
);
my $slave1_port = $sb->port_for('chan_slave1');
);
my $slave1_port = $sb->port_for('chan_slave1');
$sb->load_file('chan_master1', "sandbox/gtid_on.sql", undef, no_wait => 1);
$sb->load_file('chan_master2', "sandbox/gtid_on.sql", undef, no_wait => 1);
$sb->load_file('chan_slave1', "sandbox/slave_channels.sql", undef, no_wait => 1);
$sb->load_file('chan_master1', "sandbox/gtid_on.sql", undef, no_wait => 1);
$sb->load_file('chan_master2', "sandbox/gtid_on.sql", undef, no_wait => 1);
$sb->load_file('chan_slave1', "sandbox/slave_channels.sql", undef, no_wait => 1);
my $cmd = "$trunk/bin/pt-stalk --no-stalk --iterations=1 --host=127.0.0.1 --port=$slave1_port --user=msandbox "
. "--password=msandbox --sleep 0 --run-time=10 --dest $dest --log $log_file --iterations=1 "
. "--run-time=2 --pid $pid_file --defaults-file=$cnf >$log_file 2>&1";
system($cmd);
sleep 5;
PerconaTest::kill_program(pid_file => $pid_file);
$output = `cat $dest/*-slave-status 2>/dev/null`;
if ( $sandbox_version lt '5.7' ) {
like(
$output,
qr/SHOW SLAVE STATUS/,
"MySQL 5.6 SLAVE STATUS"
);
} else {
like(
$output,
qr/FROM performance_schema.replication_connection_configuration JOIN performance_schema.replication_applier_configuration USING/,
"MySQL 5.7 SLAVE STATUS"
);
}
$sb->stop_sandbox(qw(chan_master1 chan_master2 chan_slave1));
}
my $slave1_port = $sb->port_for('slave1');
my $cmd = "$trunk/bin/pt-stalk --no-stalk --iterations=1 --host=127.0.0.1 --port=$slave1_port --user=msandbox "
. "--password=msandbox --sleep 0 --run-time=10 --dest $dest --log $log_file --iterations=1 "
. "--run-time=2 --pid $pid_file --defaults-file=$cnf >$log_file 2>&1";
@@ -496,21 +526,12 @@ PerconaTest::kill_program(pid_file => $pid_file);
$output = `cat $dest/*-slave-status 2>/dev/null`;
if ( $sandbox_version lt '5.7' ) {
like(
like(
$output,
qr/SHOW SLAVE STATUS/,
"MySQL 5.6 SLAVE STATUS"
);
} else {
like(
$output,
qr/FROM performance_schema.replication_connection_configuration JOIN performance_schema.replication_applier_configuration USING/,
"MySQL 5.7 SLAVE STATUS"
);
}
);
$sb->stop_sandbox(qw(chan_master1 chan_master2 chan_slave1));
# #############################################################################
# Done.
# #############################################################################