PT-2156 Fix tests for lib, part2 (#650)

* PT-2156 - Fix tests for lib

Fixed tests, broken by putting fix for PT-1554 into the library code, mostly by updating checksums.
Added AutoCommit option for test lib/QueryReview.t
Reset SQL mode to empty to allow TableChunker to work with invalid and zero dates

* PT-2156 - Fix tests for lib

Adjusted t/lib/SchemaIterator.t to work with version 8.0

* PT-2156 - Fix tests for lib

Adjusted b/t/lib/Processlist.t, so it reflects fix for PT-981

* PT-2156 - Fix tests for lib

Adjusted t/lib/HTTP/Micro.t, so it works with different order of parameters, returned at v.percona.com/
Adjusted test for empty files in t/lib/bash/collect.t
Disabled mysqladmin debug test in t/lib/bash/collect.t, because of PT-2242

* PT-2156 - Fix tests for lib

Added LC_NUMERRIC=POSIX into t/lib/bash/report_system_info.sh, so reports in tests are not environment-dependent
Updated expected results in t/lib/bash/report_system_info.sh, so they reflect new information, collected by pt-summary

* PT-2156 - Fix tests for lib

- Improved fix for PT-76, so it handles inline comments
- Added test case for PT-76
- Improved fix for PT-1720, so it ignores unrecognizable option only if it comes from the toolkit-wide files and still errors out if wrong option was passed via command line or the tool-specific option file.

* PT-2156 - Fix tests for lib

- Improved fix for PT-2102, so it finds running instance configuration file using PID and also does not break t/lib/bash/report_mysql_info.t test
- Removed unnecessary copy-paste from t/pt-mysql-summary/pt-2102.t test
- Adjusted number of collected files in t/lib/bash/collect_mysql_info.sh

* PT-2156 - Fix tests for lib

- Fix for PT-1543 and MyRocks collection were originally put only into lib/bash/report_mysql_info.shthat broke the logic of collecting data first, then formatting report from this data. This, in its turn, broke test t/lib/bash/report_mysql_info.sh/t/lib/bash/report_mysql_info.t, because CMD_MYSQL is not defined in this library. I rewrote these fixes, so they follow original logic of the tool (pt-mysql-summary)
- Added tests for keyring plugin, encrypted tables, and MyRocks for t/lib/bash/report_mysql_info.sh and t/pt-mysql-summary/pt-mysql-summary_encryption.t

* PT-2156 - Fix tests for lib

- Added FLUSH TABLES to t/lib/bash/collect.sh, so it does not fail opentables tests if run when more than 1000 tables open in the sandbox environment
- Changed number of expected sample files to reflect keyring colletion file

* PT-2156 - Fix tests for lib

- Added skip to some tests in lib that file when run with PXC, because not supported to work with PXC
- Adjusted configuration files for PXC, so they allow LOAD DATA/SELECT INTO OUTFILE commands
- Adjusted data samples, so they do not depend on auto increment values
- Fixed lib tests, failing with PXC

* PT-2156 - Fix tests for lib

Updated tests for pt-online-schema-change, so they work with PXC and skipped if designed for semi-synchronous replication setup

* PT-2156 - Fix tests for lib

- Added cluster-specific samples for t/lib/SchemaIterator.t
- Removed extra debugging print from t/pt-table-checksum/pt-1728.t

* PT-2156 - Fix tests for lib

Evgeniy's review on July 20

* Update t/lib/TableSyncer.t

Removed comment left after debugging

* Update t/pt-mysql-summary/pt-mysql-summary_encryption.t

Removed extra debug output

* PT-2156 - Fix tests for lib

Tabs to spaces
This commit is contained in:
Sveta Smirnova
2023-08-02 14:50:21 +03:00
committed by GitHub
parent 156372fb73
commit 9755074cd8
234 changed files with 21507 additions and 1164 deletions

View File

@@ -16,6 +16,10 @@ source "$LIB_DIR/safeguards.sh"
source "$LIB_DIR/alt_cmds.sh"
source "$LIB_DIR/collect.sh"
# We need flush tables, otherwise we won't have stable results for opentables tests
CMD_MYSQL="$(_which mysql)"
$CMD_MYSQL --defaults-file=/tmp/12345/my.sandbox.cnf -ss -e 'FLUSH TABLES'
parse_options "$BIN_DIR/pt-stalk" --run-time 1 -- --defaults-file=/tmp/12345/my.sandbox.cnf
# Prefix (with path) for the collect files.
@@ -68,15 +72,6 @@ cmd_ok \
"grep -q 'error log seems to be .*/mysqld.log' $p-output" \
"Finds MySQL error log"
if [[ "$SANDBOX_VERSION" > "5.0" ]]; then
wait_for_files "$p-log_error"
cmd_ok \
"grep -qE 'Memory status|Open streams|Begin safemalloc' $p-log_error" \
"debug"
else
is "1" "1" "SKIP Can't determine MySQL 5.0 error log"
fi
if [ "$(which lsof 2>/dev/null)" ]; then
cmd_ok \
"grep -q 'COMMAND[ ]\+PID[ ]\+USER' $p-lsof" \
@@ -126,7 +121,10 @@ for file in $p-*; do
empty_files=1
break
fi
if [ -z "$(grep -v '^TS ' --max-count 1 $file)" ]; then
# We need additional check here in case if first match
# is empty string.
if [ 0 -eq "$(grep -vc '^TS ' --max-count 1 $file)" ] ||
[ 0 -eq "$(grep -vc '^$' --max-count 1 $file)" ]; then
empty_files=1
break
fi
@@ -134,6 +132,37 @@ done
is "$empty_files" "0" "No empty files"
# ###########################################################################
# Debug option for mysqladmin is not default now, we will test it separately.
# ###########################################################################
#Skipping until PT-2242 is fixed
if false; then
parse_options "$BIN_DIR/pt-stalk" --run-time 2 -- --defaults-file=/tmp/12345/my.sandbox.cnf
rm $PT_TMPDIR/collect/*
# Prefix (with path) for the collect files.
p="$PT_TMPDIR/collect/2011_12_05"
CMD_MYSQLADMIN="mysqladmin debug"
# Default collect, no extras like gdb, tcpdump, etc.
collect "$PT_TMPDIR/collect" "2011_12_05" > $p-output 2>&1
wait_for_files "$p-hostname" "$p-opentables2" "$p-variables" "$p-df" "$p-innodbstatus2"
if [[ "$SANDBOX_VERSION" > "5.0" ]]; then
wait_for_files "$p-log_error"
cmd_ok \
"grep -qE 'Memory status|Open streams|Begin safemalloc' $p-log_error" \
"debug"
else
is "1" "1" "SKIP Can't determine MySQL 5.0 error log"
fi
else
is "1" "1" "SKIP until PT-2242 is fixed"
fi
# ###########################################################################
# Try longer run time.
# ###########################################################################

View File

@@ -42,9 +42,9 @@ wait
file_count=$(ls "$p" | wc -l)
if [ "$sys_cnf_file" ]; then
n_files=14
n_files=18
else
n_files=13
n_files=17
fi
is $file_count $n_files "Creates the correct number of files (without --databases)"

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
plan 44
plan 46
. "$LIB_DIR/alt_cmds.sh"
. "$LIB_DIR/log_warn_die.sh"
@@ -231,7 +231,8 @@ is \
echo "INNODB_CMP ACTIVE" >> $PT_TMPDIR/plugins
is \
"$(get_plugin_status $PT_TMPDIR/plugins "INNODB_CMP" )" \
"ACTIVE"
"ACTIVE" \
"InnoDB compression active"
cat <<EOF > $PT_TMPDIR/plugins
binlog ACTIVE STORAGE ENGINE NULL GPL
@@ -476,7 +477,7 @@ cat <<EOF > "$PT_TMPDIR/expected"
EOF
format_overall_db_stats "$samples/mysql-schema-001.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "format_overall_db_stats"
cat <<EOF > $PT_TMPDIR/expected
@@ -719,7 +720,10 @@ OPT_READ_SAMPLES=""
OPT_ALL_DATABASES=""
NAME_VAL_LEN=25
report_mysql_summary "$samples/tempdir" | tail -n+3 > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$samples/expected_result_report_summary.txt"
no_diff \
"$PT_TMPDIR/got" \
"$samples/expected_result_report_summary.txt" \
"report_mysql_summary, default result"
_NO_FALSE_NEGATIVES=""
OPT_SLEEP=10
@@ -753,6 +757,18 @@ no_diff \
"$samples/expected_output_temp007.txt" \
"report_mysql_summary, dir: temp007 (PXC, traditional master)"
report_mysql_summary "$samples/temp_enc008" 2>/dev/null | tail -n+3 > "$PT_TMPDIR/got"
no_diff \
"$PT_TMPDIR/got" \
"$samples/expected_output_temp_enc008.txt" \
"report_mysql_summary, dir: temp_enc008 (libjemalloc, encryption)"
report_mysql_summary "$samples/temp_enc009" 2>/dev/null | tail -n+3 > "$PT_TMPDIR/got"
no_diff \
"$PT_TMPDIR/got" \
"$samples/expected_output_temp_enc009.txt" \
"report_mysql_summary, dir: temp_enc009 (keyring plugin, MyRocks)"
# ###########################################################################
# parse_wsrep_provider_options
# ###########################################################################
@@ -803,7 +819,6 @@ no_diff \
"Bug 1015590: section_percona_server_features works on 5.1 with innodb_adaptive_checkpoint=none"
section_percona_server_features "$samples/percona-server-5.1-variables-martin" > "$PT_TMPDIR/got"
cp "$PT_TMPDIR/got" /tmp/dasgot
no_diff \
"$PT_TMPDIR/got" \
"$samples/expected_output_ps-5.1-martin.txt" \

View File

@@ -768,6 +768,7 @@ cat <<EOF > "$PT_TMPDIR/expected"
Total | 3.9G
Free | 1.4G
Used | physical = 2.5G, swap allocated = 4.9G, swap used = 0.0, virtual = 2.5G
Shared | 0.0
Buffers | 131.8M
Caches | 1.9G
Dirty | 60 kB
@@ -832,6 +833,7 @@ cat <<EOF > "$PT_TMPDIR/expected"
Total | 1010.5M
Free | 784.4M
Used | physical = 226.1M, swap allocated = 2.0G, swap used = 0.0, virtual = 226.1M
Shared | 0.0
Buffers | 48.8M
Caches | 122.2M
Dirty | 152 kB
@@ -1316,10 +1318,10 @@ Architecture | CPU = 32-bit, OS = 32-bit
Speeds | 2109
Models | AMD Athlon(tm) 64 X2 Dual Core Processor 4000+
# Memory #####################################################
Total | 499.4M
Virtual | 511.9M
Used | 66.4M
UsedRSS | 17.7M
Total | 499.4M
Virtual | 511.9M
Used | 66.4M
UsedRSS | 17.7M
# Mounted Filesystems ########################################
Filesystem Size Used Type Opts Mountpoint
/dev/ad0s1a 620M 30% ufs local /
@@ -1353,6 +1355,8 @@ Architecture | CPU = 32-bit, OS = 32-bit
0 0 0 58164 339792 0 0 0 0 0 0 0 0 230 107 231 0 9 91
0 0 0 58164 339792 0 0 0 0 0 0 0 0 230 107 229 0 3 97
0 0 0 58164 339792 0 0 0 0 0 0 0 0 231 115 229 0 5 95
# Memory management ##########################################
Transparent huge pages are enabled.
# The End ####################################################
EOF
report_system_summary "$samples/BSD/freebsd_001" | tail -n +3 > "$PT_TMPDIR/got"
@@ -1372,10 +1376,10 @@ Architecture | CPU = 32-bit, OS = 32-bit
Models | 1xAMD Athlon(tm) 64 X2 Dual Core Processor 4000+
Caches |
# Memory #####################################################
Total | 127.6M
User | 127.2M
Swap | 64.5M
UsedRSS | 10.6M
Total | 127.6M
User | 127.2M
Swap | 64.5M
UsedRSS | 10.6M
# Mounted Filesystems ########################################
Filesystem Size Used Type Opts Mountpoint
/dev/sd0e 3.8G 0% yp dev/sd0e 3.8G 17M 3.7G 0% /mnt/usb on /mnt/usb type msdos (local /mnt/usb
@@ -1407,6 +1411,8 @@ Architecture | CPU = 32-bit, OS = 32-bit
0 0 0 78564 21364 1208 0 0 0 0 0 0 0 98 806 43 2 9 89
0 0 0 78564 21364 0 0 0 0 0 0 0 0 101 11 9 0 0 100
0 0 0 78564 21364 0 0 0 0 0 0 0 0 101 11 10 0 0 100
# Memory management ##########################################
Transparent huge pages are enabled.
# The End ####################################################
EOF
report_system_summary "$samples/BSD/netbsd_001" | tail -n +3 > "$PT_TMPDIR/got"
@@ -1425,10 +1431,10 @@ Architecture | CPU = 32-bit, OS = 32-bit
Speeds | 2111
Models | AMD
# Memory #####################################################
Total | 255.5M
User | 255.5M
Swap | 81.1M
UsedRSS | 5.3M
Total | 255.5M
User | 255.5M
Swap | 81.1M
UsedRSS | 5.3M
# Mounted Filesystems ########################################
Filesystem Size Used Type Opts Mountpoint
/dev/sd0i 3.8G 0% yp long /mnt/usb
@@ -1459,6 +1465,8 @@ Architecture | CPU = 32-bit, OS = 32-bit
1 0 0 7600 191360 9461 0 0 0 0 0 0 0 256 14435 285 6 94 0
0 0 0 7496 191456 1272 0 0 0 0 0 0 0 256 1973 50 2 12 85
0 0 0 7496 191456 11 0 0 0 0 0 0 0 230 23 12 0 0 100
# Memory management ##########################################
Transparent huge pages are enabled.
# The End ####################################################
EOF
report_system_summary "$samples/BSD/openbsd_001" | tail -n +3 > "$PT_TMPDIR/got"
@@ -1482,15 +1490,16 @@ Architecture | CPU = 32-bit, OS = 32-bit
Models | 2xIntel(R) Atom(TM) CPU N455 @ 1.66GHz
Caches | 2x512 KB
# Memory #####################################################
Total | 2.0G
Free | 477.3M
Used | physical = 1.5G, swap allocated = 2.0G, swap used = 0.0, virtual = 1.5G
Buffers | 194.9M
Caches | 726.8M
Dirty | 144 kB
UsedRSS | 1.1G
Swappiness | 60
DirtyPolicy | 20, 10
Total | 2.0G
Free | 477.3M
Used | physical = 1.5G, swap allocated = 2.0G, swap used = 0.0, virtual = 1.5G
Shared | 0.0
Buffers | 194.9M
Caches | 726.8M
Dirty | 144 kB
UsedRSS | 1.1G
Swappiness | 60
DirtyPolicy | 20, 10
Locator Size Speed Form Factor Type Type Detail
========= ======== ================= ============= ============= ===========
DIMM0 2048 MB 667 MHz (1.5 ns) SODIMM DDR2 Synchronous
@@ -1577,6 +1586,8 @@ Unable to collect information
0 0 0 0 0 0 200 200 1 0 99 0
1 0 0 0 0 150 225 225 1 1 95 3
0 0 0 0 0 150 250 250 1 0 99 0
# Memory management ##########################################
Transparent huge pages are enabled.
# The End ####################################################
EOF