From 66470938d7aa44f8725dec0d3d5f7361364d26d8 Mon Sep 17 00:00:00 2001 From: frank-cizmich Date: Sat, 16 Jan 2016 19:50:18 -0300 Subject: [PATCH] fixed pt-upgrade tests for 5.7 compatibility --- t/pt-upgrade/compare_hosts.t | 13 +++++++++++++ t/pt-upgrade/compare_results.t | 13 +++++++++++++ t/pt-upgrade/diff_warnings.t | 16 ++++++++++++++++ t/pt-upgrade/run_time.t | 2 +- 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/t/pt-upgrade/compare_hosts.t b/t/pt-upgrade/compare_hosts.t index 1dcffff9..4a904f68 100644 --- a/t/pt-upgrade/compare_hosts.t +++ b/t/pt-upgrade/compare_hosts.t @@ -56,6 +56,16 @@ sub load_sample_sql_files { } } +# default 5.7 mode "STRICT_TRANS_TABLES" converts truncation warnings to errors +# as this is simply a change in category of difference, we disable it for +# test to work. + +use SqlModes; +my $modes_host1 = new SqlModes($dbh1, global=>1); +my $modes_host2 = new SqlModes($dbh2, global=>1); +$modes_host1->del('STRICT_TRANS_TABLES'); +$modes_host2->del('STRICT_TRANS_TABLES'); + while ( my $sampleno = readdir $dh ) { next unless $sampleno =~ m/^\d+$/; @@ -103,6 +113,9 @@ while ( my $sampleno = readdir $dh ) { close $dh; +$modes_host1->restore_original_modes(); +$modes_host2->restore_original_modes(); + # ############################################################################# # Done. # ############################################################################# diff --git a/t/pt-upgrade/compare_results.t b/t/pt-upgrade/compare_results.t index 0eaa6316..4c64f06d 100644 --- a/t/pt-upgrade/compare_results.t +++ b/t/pt-upgrade/compare_results.t @@ -59,6 +59,16 @@ sub load_sample_sql_files { } } +# default 5.7 mode "STRICT_TRANS_TABLES" converts truncation warnings to errors +# as this is simply a change in category of difference, we disable it for +# test to work. + +use SqlModes; +my $modes_host1 = new SqlModes($dbh1, global=>1); +my $modes_host2 = new SqlModes($dbh2, global=>1); +$modes_host1->del('STRICT_TRANS_TABLES'); +$modes_host2->del('STRICT_TRANS_TABLES'); + while ( my $sampleno = readdir $dh ) { next unless $sampleno =~ m/^\d+$/; @@ -123,6 +133,9 @@ while ( my $sampleno = readdir $dh ) { close $dh; +$modes_host1->restore_original_modes(); +$modes_host2->restore_original_modes(); + # ############################################################################# # Done. # ############################################################################# diff --git a/t/pt-upgrade/diff_warnings.t b/t/pt-upgrade/diff_warnings.t index cb5da71c..4675756b 100644 --- a/t/pt-upgrade/diff_warnings.t +++ b/t/pt-upgrade/diff_warnings.t @@ -36,13 +36,26 @@ sub clear_warnings { $dbh2->do("SELECT /* clear warnings */ 1 FROM mysql.user"); } +# default 5.7 mode "STRICT_TRANS_TABLES" converts truncation warnings to errors +# as this is simply a change in category of difference, we disable it for +# test to work. + +use SqlModes; +my $modes_host1 = new SqlModes($dbh1, global=>1); +my $modes_host2 = new SqlModes($dbh2, global=>1); +$modes_host1->del('STRICT_TRANS_TABLES'); +$modes_host2->del('STRICT_TRANS_TABLES'); + $dbh1->do("INSERT INTO test.t VALUES (2, '', 123456789)"); $dbh2->do("INSERT INTO test.t VALUES (3, '', 123456789)"); + my $event_exec = EventExecutor->new(); my $w1 = $event_exec->get_warnings(dbh => $dbh1); my $w2 = $event_exec->get_warnings(dbh => $dbh2); + + my $error_1264 = { code => '1264', level => 'Warning', @@ -111,6 +124,9 @@ is_deeply( 'Ignore a warning' ) or diag(Dumper($diffs)); +$modes_host1->restore_original_modes(); +$modes_host2->restore_original_modes(); + # ############################################################################# # Done. # ############################################################################# diff --git a/t/pt-upgrade/run_time.t b/t/pt-upgrade/run_time.t index 8d1e65f5..e65f2ebb 100644 --- a/t/pt-upgrade/run_time.t +++ b/t/pt-upgrade/run_time.t @@ -59,7 +59,7 @@ $output = output( my $t = time - $t0; ok( - $t >= 3 && $t <= 6, + $t >= 3 && $t <= ($ENV{PERCONA_SLOW_BOX} ? 8 : 6), "Exec queries: ran for roughly --run-time seconds" ) or diag($output, 'Actual run time:', $t);