mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +00:00
Fix tests.
This commit is contained in:
@@ -1036,9 +1036,10 @@ collect_mysql_info () {
|
|||||||
echo "pt-summary-internal-Config_File_path $cnf_file" >> "$dir/mysql-variables"
|
echo "pt-summary-internal-Config_File_path $cnf_file" >> "$dir/mysql-variables"
|
||||||
collect_internal_vars "$dir/mysqld-executables" >> "$dir/mysql-variables"
|
collect_internal_vars "$dir/mysqld-executables" >> "$dir/mysql-variables"
|
||||||
|
|
||||||
if [ -n "${OPT_DATABASES}" ]; then
|
if [ "$OPT_DATABASES" -o "$OPT_ALL_DATABASES" ]; then
|
||||||
local trg_arg="$( get_mysqldump_args "$dir/mysql-variables" )"
|
local trg_arg="$(get_mysqldump_args "$dir/mysql-variables")"
|
||||||
get_mysqldump_for "${trg_arg}" "${OPT_DATABASES}" > "$dir/mysqldump"
|
local dbs="${OPT_DATABASES:-""}"
|
||||||
|
get_mysqldump_for "${trg_arg}" "$dbs" > "$dir/mysqldump"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
@@ -2243,27 +2244,16 @@ report_mysql_summary () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
section "Schema"
|
section "Schema"
|
||||||
if [ "${OPT_DATABASES}" ] \
|
if [ -s "$dir/mysqldump" ] \
|
||||||
|| [ "${OPT_ALL_DATABASES}" ] \
|
&& grep 'CREATE TABLE' "$dir/mysqldump" >/dev/null 2>&1; then
|
||||||
|| [ "${OPT_READ_SAMPLES}" ]; then
|
format_overall_db_stats "$dir/mysqldump"
|
||||||
|
elif [ ! -e "$dir/mysqldump" -a "$OPT_READ_SAMPLES" ]; then
|
||||||
if [ -z "$OPT_READ_SAMPLES" ]; then
|
echo "Skipping schema analysis because --read-samples $dir/mysqldump " \
|
||||||
local trg_arg="$(get_mysqldump_args "$dir/mysql-variables")"
|
"does not exist"
|
||||||
local dbstodump="${OPT_DATABASES:-""}"
|
elif [ -z "$OPT_DATABASES" -a -z "$OPT_ALL_DATABASES" ]; then
|
||||||
get_mysqldump_for "${trg_arg}" "${OPT_DATABASES}" > "$dir/mysqldump"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -e "$dir/mysqldump" -a -s "$dir/mysqldump" ] \
|
|
||||||
&& grep 'CREATE TABLE' "$dir/mysqldump" >/dev/null 2>&1; then
|
|
||||||
format_overall_db_stats "$dir/mysqldump"
|
|
||||||
elif [ ! -e "$dir/mysqldump" -a "$OPT_READ_SAMPLES" ]; then
|
|
||||||
echo "Skipping schema analysis as the directory passed in" \
|
|
||||||
"doesn't have a dump file"
|
|
||||||
else
|
|
||||||
echo "Skipping schema analysis due to apparent error in dump file"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Specify --databases or --all-databases to dump and summarize schemas"
|
echo "Specify --databases or --all-databases to dump and summarize schemas"
|
||||||
|
else
|
||||||
|
echo "Skipping schema analysis due to apparent error in dump file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
section "Noteworthy Technologies"
|
section "Noteworthy Technologies"
|
||||||
|
@@ -250,10 +250,11 @@ collect_mysql_info () {
|
|||||||
echo "pt-summary-internal-Config_File_path $cnf_file" >> "$dir/mysql-variables"
|
echo "pt-summary-internal-Config_File_path $cnf_file" >> "$dir/mysql-variables"
|
||||||
collect_internal_vars "$dir/mysqld-executables" >> "$dir/mysql-variables"
|
collect_internal_vars "$dir/mysqld-executables" >> "$dir/mysql-variables"
|
||||||
|
|
||||||
if [ -n "${OPT_DATABASES}" ]; then
|
# mysqldump schemas
|
||||||
# "--dump-schemas passed in, dumping early"
|
if [ "$OPT_DATABASES" -o "$OPT_ALL_DATABASES" ]; then
|
||||||
local trg_arg="$( get_mysqldump_args "$dir/mysql-variables" )"
|
local trg_arg="$(get_mysqldump_args "$dir/mysql-variables")"
|
||||||
get_mysqldump_for "${trg_arg}" "${OPT_DATABASES}" > "$dir/mysqldump"
|
local dbs="${OPT_DATABASES:-""}"
|
||||||
|
get_mysqldump_for "${trg_arg}" "$dbs" > "$dir/mysqldump"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: gather this data in the same format as normal: TS line, stats
|
# TODO: gather this data in the same format as normal: TS line, stats
|
||||||
|
@@ -1318,31 +1318,19 @@ report_mysql_summary () {
|
|||||||
# Schema, databases, data type, other analysis.
|
# Schema, databases, data type, other analysis.
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
section "Schema"
|
section "Schema"
|
||||||
if [ "${OPT_DATABASES:-""}" ] \
|
# Test the result by checking the file, not by the exit status, because we
|
||||||
|| [ "${OPT_ALL_DATABASES:-""}" ] \
|
# might get partway through and then die, and the info is worth analyzing
|
||||||
|| [ "${OPT_READ_SAMPLES:-""}" ]; then
|
# anyway.
|
||||||
|
if [ -s "$dir/mysqldump" ] \
|
||||||
if [ -z "$OPT_READ_SAMPLES" ]; then
|
&& grep 'CREATE TABLE' "$dir/mysqldump" >/dev/null 2>&1; then
|
||||||
# --databases or --all-databases was specified
|
format_overall_db_stats "$dir/mysqldump"
|
||||||
local trg_arg="$(get_mysqldump_args "$dir/mysql-variables")"
|
elif [ ! -e "$dir/mysqldump" -a "$OPT_READ_SAMPLES" ]; then
|
||||||
local dbstodump="${OPT_DATABASES:-""}"
|
echo "Skipping schema analysis because --read-samples $dir/mysqldump " \
|
||||||
get_mysqldump_for "${trg_arg}" "${OPT_DATABASES}" > "$dir/mysqldump"
|
"does not exist"
|
||||||
fi
|
elif [ -z "$OPT_DATABASES" -a -z "$OPT_ALL_DATABASES" ]; then
|
||||||
|
|
||||||
# Test the result by checking the file, not by the exit status, because we
|
|
||||||
# might get partway through and then die, and the info is worth analyzing
|
|
||||||
# anyway.
|
|
||||||
if [ -e "$dir/mysqldump" -a -s "$dir/mysqldump" ] \
|
|
||||||
&& grep 'CREATE TABLE' "$dir/mysqldump" >/dev/null 2>&1; then
|
|
||||||
format_overall_db_stats "$dir/mysqldump"
|
|
||||||
elif [ ! -e "$dir/mysqldump" -a "$OPT_READ_SAMPLES" ]; then
|
|
||||||
echo "Skipping schema analysis as the directory passed in" \
|
|
||||||
"doesn't have a dump file"
|
|
||||||
else
|
|
||||||
echo "Skipping schema analysis due to apparent error in dump file"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Specify --databases or --all-databases to dump and summarize schemas"
|
echo "Specify --databases or --all-databases to dump and summarize schemas"
|
||||||
|
else
|
||||||
|
echo "Skipping schema analysis due to apparent error in dump file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
|
@@ -715,6 +715,7 @@ no_diff \
|
|||||||
OPT_SLEEP=1
|
OPT_SLEEP=1
|
||||||
OPT_DATABASES=""
|
OPT_DATABASES=""
|
||||||
OPT_READ_SAMPLES=""
|
OPT_READ_SAMPLES=""
|
||||||
|
OPT_ALL_DATABASES=""
|
||||||
NAME_VAL_LEN=25
|
NAME_VAL_LEN=25
|
||||||
report_mysql_summary "$samples/tempdir" | tail -n+3 > "$PT_TMPDIR/got"
|
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"
|
||||||
|
@@ -66,12 +66,12 @@ for my $i (2..7) {
|
|||||||
no_diff(
|
no_diff(
|
||||||
sub {
|
sub {
|
||||||
local $ENV{_NO_FALSE_NEGATIVES} = 1;
|
local $ENV{_NO_FALSE_NEGATIVES} = 1;
|
||||||
print `$env $trunk/bin/$tool --read-samples $trunk/t/pt-mysql-summary/samples/temp00$i -- --defaults-file=/tmp/12345/my.sandbox.cnf | tail -n+3 | perl -wlnpe 's/Skipping schema analysis.*/Skipping schema analysis/'`
|
print `$env $trunk/bin/$tool --read-samples $trunk/t/pt-mysql-summary/samples/temp00$i -- --defaults-file=/tmp/12345/my.sandbox.cnf | tail -n+3 | perl -wlnpe 's/Skipping schema analysis.*/Specify --databases or --all-databases to dump and summarize schemas/'`
|
||||||
},
|
},
|
||||||
"t/pt-mysql-summary/samples/expected_output_temp00$i.txt",
|
"t/pt-mysql-summary/samples/expected_output_temp00$i.txt",
|
||||||
),
|
),
|
||||||
"--read-samples works for t/pt-mysql-summary/temp00$i",
|
"--read-samples works for t/pt-mysql-summary/temp00$i",
|
||||||
);
|
) or diag($test_diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test that --help works under sh
|
# Test that --help works under sh
|
||||||
|
@@ -108,7 +108,7 @@ Uptime 90000 1 1
|
|||||||
Usage | 0%
|
Usage | 0%
|
||||||
HitToInsertRatio | 0%
|
HitToInsertRatio | 0%
|
||||||
# Schema #####################################################
|
# Schema #####################################################
|
||||||
Skipping schema analysis
|
Specify --databases or --all-databases to dump and summarize schemas
|
||||||
# Noteworthy Technologies ####################################
|
# Noteworthy Technologies ####################################
|
||||||
SSL | No
|
SSL | No
|
||||||
Explicit LOCK TABLES | No
|
Explicit LOCK TABLES | No
|
||||||
|
@@ -107,7 +107,7 @@ Uptime 90000 1 1
|
|||||||
Usage | 0%
|
Usage | 0%
|
||||||
HitToInsertRatio | 0%
|
HitToInsertRatio | 0%
|
||||||
# Schema #####################################################
|
# Schema #####################################################
|
||||||
Skipping schema analysis
|
Specify --databases or --all-databases to dump and summarize schemas
|
||||||
# Noteworthy Technologies ####################################
|
# Noteworthy Technologies ####################################
|
||||||
SSL | No
|
SSL | No
|
||||||
Explicit LOCK TABLES | No
|
Explicit LOCK TABLES | No
|
||||||
|
Reference in New Issue
Block a user