mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 05:29:30 +00:00
Change mk_tool::main() to pt_tool::main() in all tests.
This commit is contained in:
@@ -47,49 +47,49 @@ my @args = qw(--dry-run --where 1=1);
|
||||
# ###########################################################################
|
||||
|
||||
# Test --for-update
|
||||
$output = output(sub {mk_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", qw(--for-update --purge)) });
|
||||
$output = output(sub {pt_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", qw(--for-update --purge)) });
|
||||
like($output, qr/SELECT .*? FOR UPDATE/, '--for-update');
|
||||
|
||||
# Test --share-lock
|
||||
$output = output(sub {mk_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", qw(--share-lock --purge)) });
|
||||
$output = output(sub {pt_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", qw(--share-lock --purge)) });
|
||||
like($output, qr/SELECT .*? LOCK IN SHARE MODE/, '--share-lock');
|
||||
|
||||
# Test --quick-delete
|
||||
$output = output(sub {mk_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", qw(--quick-delete --purge)) });
|
||||
$output = output(sub {pt_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", qw(--quick-delete --purge)) });
|
||||
like($output, qr/DELETE QUICK/, '--quick-delete');
|
||||
|
||||
# Test --low-priority-delete
|
||||
$output = output(sub {mk_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", qw(--low-priority-delete --purge)) });
|
||||
$output = output(sub {pt_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", qw(--low-priority-delete --purge)) });
|
||||
like($output, qr/DELETE LOW_PRIORITY/, '--low-priority-delete');
|
||||
|
||||
# Test --low-priority-insert
|
||||
$output = output(sub {mk_archiver::main(@args, qw(--dest t=table_2), '--source', "D=test,t=table_1,F=$cnf", qw(--low-priority-insert)) });
|
||||
$output = output(sub {pt_archiver::main(@args, qw(--dest t=table_2), '--source', "D=test,t=table_1,F=$cnf", qw(--low-priority-insert)) });
|
||||
like($output, qr/INSERT LOW_PRIORITY/, '--low-priority-insert');
|
||||
|
||||
# Test --delayed-insert
|
||||
$output = output(sub {mk_archiver::main(@args, qw(--dest t=table_2), '--source', "D=test,t=table_1,F=$cnf", qw(--delayed-insert)) });
|
||||
$output = output(sub {pt_archiver::main(@args, qw(--dest t=table_2), '--source', "D=test,t=table_1,F=$cnf", qw(--delayed-insert)) });
|
||||
like($output, qr/INSERT DELAYED/, '--delay-insert');
|
||||
|
||||
# Test --replace
|
||||
$output = output(sub {mk_archiver::main(@args, qw(--dest t=table_2), '--source', "D=test,t=table_1,F=$cnf", qw(--replace)) });
|
||||
$output = output(sub {pt_archiver::main(@args, qw(--dest t=table_2), '--source', "D=test,t=table_1,F=$cnf", qw(--replace)) });
|
||||
like($output, qr/REPLACE/, '--replace');
|
||||
|
||||
# Test --high-priority-select
|
||||
$output = output(sub {mk_archiver::main(@args, qw(--high-priority-select --dest t=table_2 --source), "D=test,t=table_1,F=$cnf", qw(--replace)) });
|
||||
$output = output(sub {pt_archiver::main(@args, qw(--high-priority-select --dest t=table_2 --source), "D=test,t=table_1,F=$cnf", qw(--replace)) });
|
||||
like($output, qr/SELECT HIGH_PRIORITY/, '--high-priority-select');
|
||||
|
||||
# Test --columns
|
||||
$output = output(sub {mk_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", '--columns', 'a,b', qw(--purge)) });
|
||||
$output = output(sub {pt_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", '--columns', 'a,b', qw(--purge)) });
|
||||
like($output, qr{SELECT /\*!40001 SQL_NO_CACHE \*/ `a`,`b` FROM}, 'Only got specified columns');
|
||||
|
||||
# Test --primary-key-only
|
||||
$output = output(sub {mk_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", qw(--primary-key-only --purge)) });
|
||||
$output = output(sub {pt_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", qw(--primary-key-only --purge)) });
|
||||
like($output, qr{SELECT /\*!40001 SQL_NO_CACHE \*/ `a` FROM}, '--primary-key-only works');
|
||||
|
||||
# Test that tables must have same columns
|
||||
$output = output(sub {mk_archiver::main(@args, qw(--dest t=table_4 --source), "D=test,t=table_1,F=$cnf", qw(--purge)) }, stderr=>1);
|
||||
$output = output(sub {pt_archiver::main(@args, qw(--dest t=table_4 --source), "D=test,t=table_1,F=$cnf", qw(--purge)) }, stderr=>1);
|
||||
like($output, qr/The following columns exist in --source /, 'Column check throws error');
|
||||
$output = output(sub {mk_archiver::main(@args, qw(--no-check-columns --dest t=table_4 --source), "D=test,t=table_1,F=$cnf", qw(--purge)) });
|
||||
$output = output(sub {pt_archiver::main(@args, qw(--no-check-columns --dest t=table_4 --source), "D=test,t=table_1,F=$cnf", qw(--purge)) });
|
||||
like($output, qr/SELECT/, 'I can disable the check OK');
|
||||
|
||||
# ###########################################################################
|
||||
@@ -100,7 +100,7 @@ shift @args; # remove --dry-run
|
||||
|
||||
# Test --why-quit and --statistics output
|
||||
$sb->load_file('master', 't/pt-archiver/samples/tables1-4.sql');
|
||||
$output = output(sub {mk_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", qw(--purge --why-quit --statistics)) });
|
||||
$output = output(sub {pt_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", qw(--purge --why-quit --statistics)) });
|
||||
like($output, qr/Started at \d/, 'Start timestamp');
|
||||
like($output, qr/Source:/, 'source');
|
||||
like($output, qr/SELECT 4\nINSERT 0\nDELETE 4\n/, 'row counts');
|
||||
@@ -108,13 +108,13 @@ like($output, qr/Exiting because there are no more rows/, 'Exit reason');
|
||||
|
||||
# Test basic functionality with OPTIMIZE
|
||||
$sb->load_file('master', 't/pt-archiver/samples/tables1-4.sql');
|
||||
$output = output(sub {mk_archiver::main(@args, qw(--optimize ds --source), "D=test,t=table_1,F=$cnf", qw(--purge)) });
|
||||
$output = output(sub {pt_archiver::main(@args, qw(--optimize ds --source), "D=test,t=table_1,F=$cnf", qw(--purge)) });
|
||||
is($output, '', 'OPTIMIZE did not fail');
|
||||
|
||||
# Test an empty table
|
||||
$sb->load_file('master', 't/pt-archiver/samples/tables1-4.sql');
|
||||
$output = `/tmp/12345/use -N -e "delete from test.table_1"`;
|
||||
$output = output(sub {mk_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", qw(--purge)) });
|
||||
$output = output(sub {pt_archiver::main(@args, '--source', "D=test,t=table_1,F=$cnf", qw(--purge)) });
|
||||
is($output, "", 'Empty table OK');
|
||||
|
||||
# Test the output
|
||||
@@ -131,15 +131,15 @@ EOF
|
||||
|
||||
# Statistics
|
||||
$sb->load_file('master', 't/pt-archiver/samples/tables1-4.sql');
|
||||
$output = output(sub {mk_archiver::main(@args, qw(--statistics --source), "D=test,t=table_1,F=$cnf", qw(--dest t=table_2)) });
|
||||
$output = output(sub {pt_archiver::main(@args, qw(--statistics --source), "D=test,t=table_1,F=$cnf", qw(--dest t=table_2)) });
|
||||
like($output, qr/commit *10/, 'Stats print OK');
|
||||
|
||||
# Test --no-delete.
|
||||
$sb->load_file('master', 't/pt-archiver/samples/tables1-4.sql');
|
||||
$output = output(sub {mk_archiver::main(@args, qw(--no-delete --purge --source), "D=test,t=table_1,F=$cnf", qw(--dry-run)) });
|
||||
$output = output(sub {pt_archiver::main(@args, qw(--no-delete --purge --source), "D=test,t=table_1,F=$cnf", qw(--dry-run)) });
|
||||
like($output, qr/> /, '--no-delete implies strict ascending');
|
||||
unlike($output, qr/>=/, '--no-delete implies strict ascending');
|
||||
$output = output(sub {mk_archiver::main(@args, qw(--no-delete --purge --source), "D=test,t=table_1,F=$cnf") });
|
||||
$output = output(sub {pt_archiver::main(@args, qw(--no-delete --purge --source), "D=test,t=table_1,F=$cnf") });
|
||||
$output = `/tmp/12345/use -N -e "select count(*) from test.table_1"`;
|
||||
is($output + 0, 4, 'All 4 rows are still there');
|
||||
|
||||
|
Reference in New Issue
Block a user