Merge staging-test-suite-error-fixes

This commit is contained in:
Daniel Nichter
2012-08-15 19:43:52 -06:00
8 changed files with 107 additions and 97 deletions

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 37;
use Test::More;
use DSNParser;
use OptionParser;
@@ -545,6 +545,9 @@ foreach my $password_comma ( @password_commas ) {
# #############################################################################
# Bug 984915: SQL calls after creating the dbh aren't checked
# #############################################################################
# Make sure to disconnect any lingering dbhs, since full_output will fork
# and then die, which will cause rollback warnings for connected dbhs.
$dbh->disconnect() if $dbh;
$dsn = $dp->parse('h=127.1,P=12345,u=msandbox,p=msandbox');
my @opts = $dp->get_cxn_params($dsn);
@@ -569,5 +572,4 @@ like(
# #############################################################################
# Done.
# #############################################################################
$dbh->disconnect() if $dbh;
exit;
done_testing;

View File

@@ -9,13 +9,13 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 22;
use Test::More;
use Time::HiRes qw(sleep);
use File::Temp qw( tempfile );
use Daemon;
use OptionParser;
use PerconaTest;
#plan skip_all => "Hm";
use constant PTDEVDEBUG => $ENV{PTDEVDEBUG} || 0;
my $o = new OptionParser(file => "$trunk/t/lib/samples/daemonizes.pl");
@@ -263,4 +263,5 @@ ok(
# Done.
# #############################################################################
rm_tmp_files();
done_testing;
exit;

View File

@@ -9,15 +9,13 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 108;
use PerconaTest;
use OptionParser;
use Test::More;
use File::Spec;
use File::Temp ();
use PerconaTest;
use OptionParser;
BEGIN {
use_ok "Diskstats";
use_ok "DiskstatsGroupByAll";
@@ -25,7 +23,7 @@ BEGIN {
use_ok "DiskstatsGroupBySample";
}
my $o = new OptionParser(description => 'Diskstats');
my $o = new OptionParser(description => 'Diskstats');
$o->get_specs("$trunk/bin/pt-diskstats");
$o->get_opts();
@@ -476,6 +474,7 @@ is_deeply(
$obj->clear_state();
}
# ############################################################################
# The three subclasses
# ############################################################################
@@ -491,7 +490,8 @@ for my $test (
{
class => "DiskstatsGroupBySample",
results_file_prefix => "sample",
}) {
},
) {
my $obj = $test->{class}->new(OptionParser => $o, show_inactive => 1);
my $prefix = $test->{results_file_prefix};
@@ -502,9 +502,8 @@ for my $test (
$obj->set_show_line_between_samples(0);
for my $filename ( map "diskstats-00$_.txt", 1..5 ) {
my $file = File::Spec->catfile( "t", "pt-diskstats", "samples", $filename );
my $file_with_trunk = File::Spec->catfile( $trunk, $file );
my $file = File::Spec->catfile(qw(t pt-diskstats samples), $filename);
my $file_with_trunk = File::Spec->catfile($trunk, $file);
my $expected = "t/pt-diskstats/expected/${prefix}_$filename";
ok(
@@ -571,10 +570,10 @@ EOF
qr/Time between samples should be > 0, is /,
"$test->{class}, ->_calc_deltas fails if the time elapsed is negative"
);
}
# ###########################################################################
# Done.
# ###########################################################################
done_testing;
exit;

View File

@@ -28,9 +28,6 @@ if ( !$master_dbh ) {
elsif ( !$slave1_dbh ) {
plan skip_all => 'Cannot connect to sandbox slave1';
}
else {
plan tests => 29;
}
my $output;
my $rows;
@@ -188,55 +185,57 @@ cmp_ok(
# #############################################################################
# Bug 903387: pt-archiver doesn't honor b=1 flag to create SQL_LOG_BIN statement
# #############################################################################
SKIP: {
skip('LOAD DATA LOCAL INFILE is disabled', 3) if !$can_load_data;
$sb->load_file('master', "t/pt-archiver/samples/bulk_regular_insert.sql");
$sb->wait_for_slaves();
$sb->load_file('master', "t/pt-archiver/samples/bulk_regular_insert.sql");
$sb->wait_for_slaves();
my $original_rows = $slave1_dbh->selectall_arrayref("SELECT * FROM bri.t ORDER BY id");
is_deeply(
$original_rows,
[
[1, 'aa', '11:11:11'],
[2, 'bb', '11:11:12'],
[3, 'cc', '11:11:13'],
[4, 'dd', '11:11:14'],
[5, 'ee', '11:11:15'],
[6, 'ff', '11:11:16'],
[7, 'gg', '11:11:17'],
[8, 'hh', '11:11:18'],
[9, 'ii', '11:11:19'],
[10,'jj', '11:11:10'],
],
"Bug 903387: slave has rows"
);
my $original_rows = $slave1_dbh->selectall_arrayref("SELECT * FROM bri.t ORDER BY id");
is_deeply(
$original_rows,
[
[1, 'aa', '11:11:11'],
[2, 'bb', '11:11:12'],
[3, 'cc', '11:11:13'],
[4, 'dd', '11:11:14'],
[5, 'ee', '11:11:15'],
[6, 'ff', '11:11:16'],
[7, 'gg', '11:11:17'],
[8, 'hh', '11:11:18'],
[9, 'ii', '11:11:19'],
[10,'jj', '11:11:10'],
],
"Bug 903387: slave has rows"
);
$output = output(
sub { pt_archiver::main(
'--source', "D=bri,t=t,F=$cnf,b=1",
'--dest', "D=bri,t=t_arch",
qw(--where 1=1 --replace --commit-each --bulk-insert --bulk-delete),
qw(--limit 10)) },
);
$output = output(
sub { pt_archiver::main(
'--source', "D=bri,t=t,F=$cnf,b=1",
'--dest', "D=bri,t=t_arch",
qw(--where 1=1 --replace --commit-each --bulk-insert --bulk-delete),
qw(--limit 10)) },
);
$rows = $master_dbh->selectall_arrayref("SELECT * FROM bri.t ORDER BY id");
is_deeply(
$rows,
[
[10,'jj', '11:11:10'],
],
"Bug 903387: rows deleted on master"
) or diag(Dumper($rows));
$rows = $slave1_dbh->selectall_arrayref("SELECT * FROM bri.t ORDER BY id");
is_deeply(
$rows,
$original_rows,
"Bug 903387: slave still has rows"
) or diag(Dumper($rows));
$rows = $master_dbh->selectall_arrayref("SELECT * FROM bri.t ORDER BY id");
is_deeply(
$rows,
[
[10,'jj', '11:11:10'],
],
"Bug 903387: rows deleted on master"
) or diag(Dumper($rows));
$rows = $slave1_dbh->selectall_arrayref("SELECT * FROM bri.t ORDER BY id");
is_deeply(
$rows,
$original_rows,
"Bug 903387: slave still has rows"
) or diag(Dumper($rows));
}
# #############################################################################
# Done.
# #############################################################################
$sb->wipe_clean($master_dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
exit;
done_testing;