~percona-toolkit-dev/percona-toolkit/fix-osc-quoting-bug-873598

« back to all changes in this revision

Viewing changes to t/pt-online-schema-change/basics.t

  • Committer: Daniel Nichter
  • Date: 2012-02-21 16:06:08 UTC
  • Revision ID: daniel@percona.com-20120221160608-k1i8ltncshcwbvzo
Test, update modules, and fix bug 873598 in pt-online-schema-change.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
   plan skip_all => 'Cannot connect to sandbox master';
26
26
}
27
27
else {
28
 
   plan tests => 18;
 
28
   plan tests => 22;
29
29
}
30
30
 
31
31
my $output  = "";
233
233
);
234
234
 
235
235
# #############################################################################
 
236
# Alter tables with columns with resvered words and spaces.
 
237
# #############################################################################
 
238
sub test_table {
 
239
   my (%args) = @_;
 
240
   my ($file, $name) = @args{qw(file name)};
 
241
 
 
242
   $sb->load_file('master', "t/lib/samples/osc/$file");
 
243
   PerconaTest::wait_for_table($dbh, "osc.t", "id=5");
 
244
   PerconaTest::wait_for_table($dbh, "osc.__new_t");
 
245
   $dbh->do('use osc');
 
246
   $dbh->do("DROP TABLE IF EXISTS osc.__new_t");
 
247
 
 
248
   $org_rows = $dbh->selectall_arrayref('select * from osc.t order by id');
 
249
 
 
250
   output(
 
251
      sub { $exit = pt_online_schema_change::main(@args,
 
252
         'D=osc,t=t', qw(--alter ENGINE=InnoDB)) },
 
253
   );
 
254
 
 
255
   $new_rows = $dbh->selectall_arrayref('select * from osc.t order by id');
 
256
 
 
257
   is_deeply(
 
258
      $new_rows,
 
259
      $org_rows,
 
260
      "$name rows"
 
261
   );
 
262
 
 
263
   is(
 
264
      $exit,
 
265
      0,
 
266
      "$name exit status 0"
 
267
   );
 
268
}
 
269
 
 
270
test_table(
 
271
   file => "tbl002.sql",
 
272
   name => "Reserved word column",
 
273
);
 
274
 
 
275
test_table(
 
276
   file => "tbl003.sql",
 
277
   name => "Space column",
 
278
);
 
279
 
 
280
# #############################################################################
236
281
# Done.
237
282
# #############################################################################
238
283
$sb->wipe_clean($dbh);