mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-18 17:58:55 +00:00
(temp commit, syncing up)
This commit is contained in:
51
t/lib/bash/collect_mysql_info.sh
Normal file
51
t/lib/bash/collect_mysql_info.sh
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
plan 3
|
||||
|
||||
TMPDIR="$TEST_TMPDIR"
|
||||
PATH="$PATH:$PERCONA_TOOLKIT_SANDBOX/bin"
|
||||
TOOL="pt-mysql-summary"
|
||||
|
||||
. "$LIB_DIR/log_warn_die.sh"
|
||||
. "$LIB_DIR/alt_cmds.sh"
|
||||
. "$LIB_DIR/summary_common.sh"
|
||||
. "$LIB_DIR/collect_mysql_info.sh"
|
||||
|
||||
# Prefix (with path) for the collect files.
|
||||
local p="$TMPDIR/collect_mysql_info"
|
||||
|
||||
mkdir "$p"
|
||||
|
||||
parse_options "$BIN_DIR/pt-mysql-summary" --sleep 1 -- --defaults-file=/tmp/12345/my.sandbox.cnf
|
||||
|
||||
CMD_MYSQL="$(_which mysql)"
|
||||
CMD_MYSQLDUMP="$(_which mysqldump)"
|
||||
|
||||
collect_mysql_info "$p" 1>/dev/null
|
||||
wait
|
||||
|
||||
file_count=$(ls "$p" | wc -l)
|
||||
|
||||
is $file_count 12 "Creates the correct number of files (without --dump-schemas)"
|
||||
|
||||
grep -v grep "$p/percona-toolkit-mysqld-instances" | awk '{print $2}' > "$TMPDIR/collect_mysqld_instances1.test"
|
||||
ps auxww 2>/dev/null | grep mysqld | grep -v grep | awk '{print $2}' > "$TMPDIR/collect_mysqld_instances2.test"
|
||||
|
||||
no_diff \
|
||||
"$TMPDIR/collect_mysqld_instances1.test" \
|
||||
"$TMPDIR/collect_mysqld_instances2.test" \
|
||||
"collect_mysql_info() finds the correct instances"
|
||||
|
||||
collect_mysqld_instances "$TMPDIR/collect_mysqld_instances3.test"
|
||||
|
||||
no_diff \
|
||||
"$TMPDIR/collect_mysqld_instances3.test" \
|
||||
"$TMPDIR/collect_mysqld_instances2.test" \
|
||||
"(sanity check) which are the same that collect_mysqld_instances() does"
|
||||
|
||||
$CMD_MYSQL $EXT_ARGV -ss -e 'SHOW /*!50000 GLOBAL*/ STATUS' > "$TMPDIR/collect_mysql_status"
|
||||
no_diff \
|
||||
"$p/percona-toolkit-mysql-status" \
|
||||
"$TMPDIR/collect_mysql_status" \
|
||||
"collect_mysql_info() finds the correct instances"
|
||||
|
Reference in New Issue
Block a user