From 6a4d33039cd398fa58b05842cc3944a2c4cf56c1 Mon Sep 17 00:00:00 2001 From: frank-cizmich Date: Wed, 30 Dec 2015 23:29:36 -0300 Subject: [PATCH] pt-osc fixed basics.t tests --- t/pt-online-schema-change/basics.t | 19 +++++++++--- .../samples/stats-execute-5.7.txt | 29 +++++++++++++++++++ 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 t/pt-online-schema-change/samples/stats-execute-5.7.txt diff --git a/t/pt-online-schema-change/basics.t b/t/pt-online-schema-change/basics.t index 68cfb660..7936a3a1 100644 --- a/t/pt-online-schema-change/basics.t +++ b/t/pt-online-schema-change/basics.t @@ -50,6 +50,7 @@ my $rows; # Tool shouldn't run without --execute (bug 933232). # ############################################################################# + $sb->load_file('master', "$sample/basic_no_fks_innodb.sql"); ($output, $exit) = full_output( @@ -684,6 +685,7 @@ test_alter_table( ], ); + # ############################################################################# # --statistics # ############################################################################# @@ -701,16 +703,25 @@ ok( "--statistics --dry-run" ) or diag($test_diff); +# 5.5, 5.6 and 5.7 have different outputs +my $res_file = "$sample/stats-execute.txt"; +if ($sandbox_version eq '5.5' && $db_flavor !~ m/XtraDB Cluster/) { + $res_file = "$sample/stats-execute-5.5.txt"; +} elsif ($sandbox_version eq '5.6' && $db_flavor !~ m/XtraDB Cluster/) { + $res_file = "$sample/stats-execute.txt"; +} elsif ($sandbox_version eq '5.7' && $db_flavor !~ m/XtraDB Cluster/) { + $res_file = "$sample/stats-execute-5.7.txt"; +} + + ok( no_diff( sub { pt_online_schema_change::main(@args, "$dsn,D=bug_1045317,t=bits", '--execute', '--statistics', '--alter', "modify column val ENUM('M','E','H') NOT NULL", - '--recursion-method', 'none') + '--recursion-method', 'none'), }, - ($sandbox_version ge '5.5' && $db_flavor !~ m/XtraDB Cluster/ - ? "$sample/stats-execute-5.5.txt" - : "$sample/stats-execute.txt"), + $res_file, ), "--statistics --execute" ) or diag($test_diff); diff --git a/t/pt-online-schema-change/samples/stats-execute-5.7.txt b/t/pt-online-schema-change/samples/stats-execute-5.7.txt new file mode 100644 index 00000000..aeb31344 --- /dev/null +++ b/t/pt-online-schema-change/samples/stats-execute-5.7.txt @@ -0,0 +1,29 @@ +No slaves found. See --recursion-method if host h=127.1,P=12345 has slaves. +Not checking slave lag because no slaves were found and --check-slave-lag was not specified. +Operation, tries, wait: + analyze_table, 10, 1 + copy_rows, 10, 0.25 + create_triggers, 10, 1 + drop_triggers, 10, 1 + swap_tables, 10, 1 + update_foreign_keys, 10, 1 +Altering `bug_1045317`.`bits`... +TS Dropping triggers... +TS Dropped triggers OK. +# Event Count +# ====== ===== +# INSERT 1 +Successfully altered `bug_1045317`.`bits`. +Creating new table... +Created new table bug_1045317._bits_new OK. +Altering new table... +Altered `bug_1045317`.`_bits_new` OK. +TS Creating triggers... +TS Created triggers OK. +TS Copying approximately 3 rows... +TS Copied rows OK. +TS Analyzing new table... +TS Swapping tables... +TS Swapped original and new tables OK. +TS Dropping old table... +TS Dropped old table `bug_1045317`.`_bits_old` OK.