Files
percona-toolkit/t/pt-table-checksum/pt-204.t
Sveta Smirnova a7efd8c94e PT-2138 - fix tests for pt table checksum (#568)
* PT-2138 - Fix tests for pt-table-checksum

- Updated t/pt-table-checksum/samples/default-results-8.0.txt and
t/pt-table-checksum/samples/static-chunk-size-results-8.0.txt
to support latest MySQL 8.0 version. Tests are now incompatible with elder 8.0 releases.
- Put fix for PT-136 into package RowChecksum
- Added execution bit for pt-online-schema-change

* PT-2138 - Fix tests for pt-table-checksum

- Fixed percona_test.load_data, so it really tests if LOAD DATA LOCAL INFILE is enabled
- Fixed option --[no]create-replicate-table, broken by commit c9836d5962

* PT-2138 - Fix tests for pt-table-checksum

- Enabled t/pt-table-checksum/error_handling.t for MySQL 8.0
- Fixed test t/pt-table-checksum/fnv_64.t and it's samples file
t/pt-table-checksum/samples/fnv64-sakila-city.txt
to reflect new function name convention and
changes after 62d84e5dba

* PT-2138 - Fix tests for pt-table-checksum

- Fixed t/pt-table-checksum/issue_1485195.t, so it checks only one table and
isn't get broken when we add tables into percona_test database
- Fixed typo in error output of bin/pt-table-checksum
- Skipped issue_47.t in 8.0 until https://jira.percona.com/browse/PT-1805 is fixed

* PT-2138 - Fix tests for pt-table-checksum

- Disabled pt-131.t for 8.0, because it does not have the QUERY_RESPONSE_TIME plugins
- Added SLOW_TESTS check to pt-1616.t
- Updated pt-226.t to include the fix for PT-1766
- For replication_filters.t: excluded false positive expression for tests 10 and 11 and added sys schema to the list of checked databases for 8.0
- Changed get_slaves in lib/MasterSlave.pm, so it returns slave's parent, required for wait_for_slaves in pt-table-checksum to work properly with chained slaves

* PT-2138 - Fix tests for pt-table-checksum

- Modified pt-204.t  to support 8.0 and diffs in system tables due to timestamps
Moved the fix for PT-1616 into the proper place: lib/NibbleIterator.pm

* PT-2138 - Fix tests for pt-table-checksum

- pxc.t -added mysql.proxies_priv into ignore list, because its timestamp is different on node
- pxc.t - removed FORK=pxc from statup options for slave (non-cluster) nodes
- pxc.t - disabled wsrep replication with help of the variable wsrep_on: sql_log_bin doesn't disable wsrep replication anymore. See https://jira.percona.com/browse/PXC-3464 for details
- Removed data.tar.gz from 5.7 sandbox configuration, because it has an outdated definition for Performance Schema
- Disabled pxc.t for version 8.0 until PT-1699 is fixed
- start-sandbox - removed the first line (ALTER USER) from the init file, because it was rewritten by the next echo command, and then repeated later.

* PT-2138 - Fix tests for pt-table-checksum

- Adopted issue_1485195.t and basics.t for MyRocks-enabled setup
- replication_filters.t - added sys schema to the list of expected schemas for 5.7 and 8.0
- issue_1485195.t - added checks for the existence of mysql.plugin, func, and proxies_priv tables
- added samples/pt-131-wipe.sql that uninstalls QRT plugin if it was earlier installed by this test
-adjusted return code in pt-204.t, because expected differences in mysql.proxies_priv

* Update lib/PerconaTest.pm

removed diagnostic code

Co-authored-by: Carlos Salguero <carlos.salguero@percona.com>

Co-authored-by: Carlos Salguero <carlos.salguero@percona.com>
2022-12-28 23:09:13 +03:00

117 lines
2.9 KiB
Perl

#!/usr/bin/env perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
use PerconaTest;
use Sandbox;
use SqlModes;
require "$trunk/bin/pt-table-checksum";
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('master');
if ( !$dbh ) {
plan skip_all => 'Cannot connect to sandbox master';
} elsif (!$sb->has_engine('master', 'ROCKSDB')) {
plan skip_all => 'These tests need RocksDB';
} else {
plan tests => 9;
}
$sb->load_file('master', 't/pt-table-checksum/samples/pt-204.sql');
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
# so we need to specify --set-vars innodb_lock_wait_timeout=3 else the tool will die.
# And --max-load "" prevents waiting for status variables.
my $master_dsn = $sb->dsn_for('master');
my @args = ($master_dsn, "--set-vars", "innodb_lock_wait_timeout=50",
"--no-check-binlog-format");
my ($output, $exit_status);
# Test #1
($output, $exit_status) = full_output(
sub { $exit_status = pt_table_checksum::main(@args) },
stderr => 1,
);
diag("status: $exit_status");
is(
$exit_status,
64,
"PT-204 Cannot checksum RocksDB tables. Exit status=64 -> SKIP_TABLE",
);
like(
$output,
qr/Checking if all tables can be checksummed/,
"PT-204 Message before checksum starts",
);
like(
$output,
qr/The RocksDB storage engine is not supported with pt-table-checksum/,
"PT-204 Error message: cannot checksum RocksDB tables",
);
# Test #2
($output, $exit_status) = full_output(
sub { $exit_status = pt_table_checksum::main(@args, qw(--ignore-tables test.t1)) },
stderr => 1,
);
my $return_code = ($sandbox_version >= '5.7') ? 16 : 0;
is(
$exit_status,
$return_code,
"PT-204 Starting checksum since RocksDB table was skipped with --ignore-tables",
);
like(
$output,
qr/Starting checksum/,
'PT-204 Got "Starting checksum" message',
);
unlike(
$output,
qr/test.t1/,
"PT-204 RocksDB table was really skipped with --ignore-tables",
);
# Test #3
($output, $exit_status) = full_output(
sub { $exit_status = pt_table_checksum::main(@args, qw(--ignore-engines RocksDB)) },
stderr => 1,
);
is(
$exit_status,
$return_code,
"PT-204 Starting checksum since RocksDB table was skipped with --ignore-engines",
);
unlike(
$output,
qr/test.t1/,
"PT-204 RocksDB table was really skipped with --ignore-engines",
);
# #############################################################################
# Done.
# #############################################################################
$sb->wipe_clean($dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
exit;