From a44a273800147cb5915f675df8b7901736a2b2cb Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Tue, 5 Jun 2012 11:02:48 -0700 Subject: [PATCH] Revert back to ok() for Sandbox::ok() so tests file don't have to be updated. Shorten verify_test_data_integrity() to verify_test_data(). --- lib/Sandbox.pm | 12 +++++++----- t/pt-table-checksum/basics.t | 2 +- t/pt-table-sync/lock_and_rename.t | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/Sandbox.pm b/lib/Sandbox.pm index c2c59a41..77fea7f4 100644 --- a/lib/Sandbox.pm +++ b/lib/Sandbox.pm @@ -1,4 +1,4 @@ -# This program is copyright 2008-2011 Percona Inc. +# This program is copyright 2008-2012 Percona Inc. # Feedback and improvements are welcome. # # THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED @@ -280,8 +280,10 @@ sub ok { push @errors, $self->slave_is_ok('slave1', 'master'); push @errors, $self->slave_is_ok('slave2', 'slave1', 1); push @errors, $self->leftover_servers(); - push @errors, $self->verify_test_data_integrity(); - return join(' ', grep { $_ ne '' } @errors); + push @errors, $self->verify_test_data(); + + @errors = grep { warn "ERROR: ", $_, "\n" if $_; $_; } @errors; + return !@errors; } sub _d { @@ -295,7 +297,7 @@ sub _d { # Verifies that master, slave1, and slave2 have a faithful copy of the mysql and # sakila databases. The reference data is inserted into percona_test.checksums # by util/checksum-test-dataset when sandbox/test-env starts the environment. -sub verify_test_data_integrity { +sub verify_test_data { my ($self) = @_; my $master = $self->get_dbh_for('master'); my $ref = $master->selectall_hashref( @@ -323,7 +325,7 @@ sub verify_test_data_integrity { } $master->disconnect; if ( @diffs ) { - return "Tables with differences: " . join(', ', @diffs); + return "Tables are different: " . join(', ', @diffs); } return ''; } diff --git a/t/pt-table-checksum/basics.t b/t/pt-table-checksum/basics.t index e6ea5229..0ad175a7 100644 --- a/t/pt-table-checksum/basics.t +++ b/t/pt-table-checksum/basics.t @@ -461,5 +461,5 @@ is( # Done. # ############################################################################# $sb->wipe_clean($master_dbh); -is($sb->ok(), '', "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox"); +ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox"); exit; diff --git a/t/pt-table-sync/lock_and_rename.t b/t/pt-table-sync/lock_and_rename.t index fbe15351..a83d6ffd 100644 --- a/t/pt-table-sync/lock_and_rename.t +++ b/t/pt-table-sync/lock_and_rename.t @@ -62,5 +62,5 @@ like($output, qr/COMMENT='test1'/, '--lock-and-rename worked'); # Done. # ############################################################################# $sb->wipe_clean($master_dbh); -is($sb->ok(), '', "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox"); +ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox"); exit;