pt-osc fixed several test files for 5.7 compat

This commit is contained in:
frank-cizmich
2015-12-30 16:08:00 -03:00
parent 6433c99713
commit 0c18e8969b
3 changed files with 16 additions and 9 deletions
+4 -4
View File
@@ -44,10 +44,10 @@ my $sample = "t/pt-online-schema-change/samples/";
$sb->load_file('master1', "$sample/sql-mode-bug-1058285.sql"); $sb->load_file('master1', "$sample/sql-mode-bug-1058285.sql");
my ($orig_sql_mode) = $dbh->selectrow_array(q{SELECT @@SQL_MODE}); my ($orig_sql_mode) = $dbh->selectrow_array(q{SELECT @@SQL_MODE});
is( # check that ANSI_QUOTES and ANSI is there
$orig_sql_mode, ok(
"REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI,NO_AUTO_VALUE_ON_ZERO", $orig_sql_mode =~ /ANSI_QUOTES.*ANSI/,
"SQL_MODE set" "ANSI modes set"
); );
($output, $exit_status) = full_output( ($output, $exit_status) = full_output(
+11 -4
View File
@@ -345,7 +345,8 @@ like(
# cause a MySQL warning while copying rows. # cause a MySQL warning while copying rows.
$sb->load_file('master', "$sample/basic_no_fks_innodb.sql"); $sb->load_file('master', "$sample/basic_no_fks_innodb.sql");
$master_dbh->do("INSERT INTO pt_osc.t VALUES (null, 'This string will be too long after we modify the table so it will cause a warning about the value being truncated in the new table. The other column values are a single character.', NOW())"); #This string will be too long after we modify the table so it will cause a warning about the value being truncated in the new table. The other column values are a single character. Note: if STRICT_TRANS or STRICT_ALL is set , an error is raised instead of a warning. STRICT_TRANS is default in 5.7+
$master_dbh->do("INSERT INTO pt_osc.t VALUES (null, 'This string will be too long.', NOW())");
($output, $exit_status) = full_output( ($output, $exit_status) = full_output(
sub { pt_online_schema_change::main(@args, sub { pt_online_schema_change::main(@args,
@@ -394,7 +395,7 @@ $output = output(
like( like(
$output, $output,
qr/Child tables:\s*`bug_1315130_a`\.`child_table_in_same_schema` \(approx\. 1 rows\)\s*`bug_1315130_b`\.`child_table_in_second_schema` \(approx\. 1 rows\)[^`]*?Will/s, qr/Child tables:\s*`bug_1315130_a`\.`child_table_in_same_schema` \(approx\. 1 rows\)\s*`bug_1315130_b`\.`child_table_in_second_schema` \(approx\. 1 rows\)[^`]*?Will/s,
"Correctly identify child tables from other schemas and ignores tables from same schema referencig same named parent in other schema.", "Identify child tables in other schemas and ignore child tables from same schema referencing same named parent in other schema.",
); );
# clear databases with their foreign keys # clear databases with their foreign keys
$sb->load_file('master', "$sample/bug-1315130_cleanup.sql"); $sb->load_file('master', "$sample/bug-1315130_cleanup.sql");
@@ -410,10 +411,16 @@ $sb->load_file('master', "$sample/bug-1340728_cleanup.sql");
$sb->load_file('master', "$sample/bug-1340728.sql"); $sb->load_file('master', "$sample/bug-1340728.sql");
# insert a few thousand rows (else test isn't valid) # insert a few thousand rows (else test isn't valid)
my $rows = 5000; # will make a big string to do an extended insert because it's much faster
my $big_insert = 'INSERT INTO bug_1340728.test VALUES ';
my $rows = 4999;
for (my $i = 0; $i < $rows; $i++) { for (my $i = 0; $i < $rows; $i++) {
$master_dbh->do("INSERT INTO bug_1340728.test VALUES (NULL, 'xx')"); $big_insert .= "(NULL, 'xx'),";
} }
$big_insert .= "(NULL, 'xx')";
$master_dbh->do($big_insert);
$output = output( $output = output(
@@ -6,7 +6,7 @@ CREATE TABLE `table_name` (
`site` varchar(20) NOT NULL DEFAULT '', `site` varchar(20) NOT NULL DEFAULT '',
`update_name` varchar(32) NOT NULL DEFAULT '', `update_name` varchar(32) NOT NULL DEFAULT '',
`user` varchar(64) NOT NULL DEFAULT '', `user` varchar(64) NOT NULL DEFAULT '',
`time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `time` datetime DEFAULT NULL,
`value` varchar(64) NOT NULL DEFAULT '', `value` varchar(64) NOT NULL DEFAULT '',
UNIQUE KEY `site` (`site`,`update_name`,`user`,`value`), UNIQUE KEY `site` (`site`,`update_name`,`user`,`value`),
KEY `user` (`user`) KEY `user` (`user`)