mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 13:40:07 +00:00
Add back PerconaTest::slurp_file(). Put in scope in pt-index-usage. Sort MySQL instance IDs for testing. Wait for pid file in pt-heartbeat/basics.t.
This commit is contained in:
@@ -5950,11 +5950,11 @@ sub main {
|
||||
# are given on the cmd line then parse_options() will return undef,
|
||||
# but get_cxn() required a defined dsn arg so use an empty hashref.
|
||||
# ##########################################################################
|
||||
my ($dbh, $si_dbh, $res_dbh);
|
||||
my ($dsn, $dbh, $si_dbh, $res_dbh);
|
||||
my $res_dsn;
|
||||
my $res_db;
|
||||
eval {
|
||||
my $dsn = $dp->parse_options($o) || {};
|
||||
$dsn = $dp->parse_options($o) || {};
|
||||
|
||||
# dbh for EXPLAIN-ing.
|
||||
$dbh = get_cxn(
|
||||
@@ -6086,7 +6086,7 @@ sub main {
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
{ dbh => $dbh, dsn => $dsn },
|
||||
{ dbh => $dbh, dsn => $dsn },
|
||||
($res_dbh ? { dbh => $res_dbh, dsn => $res_dsn } : ()),
|
||||
);
|
||||
}
|
||||
|
@@ -213,7 +213,13 @@ sub load_file {
|
||||
return $contents;
|
||||
}
|
||||
|
||||
sub slurp_file { Percona::Toolkit::slurp_file(@_) }
|
||||
sub slurp_file {
|
||||
my ($file) = @_;
|
||||
open my $fh, "<", $file or die "Cannot open $file: $OS_ERROR";
|
||||
my $contents = do { local $/ = undef; <$fh> };
|
||||
close $fh;
|
||||
return $contents;
|
||||
}
|
||||
|
||||
sub parse_file {
|
||||
my ( $file, $p, $ea ) = @_;
|
||||
|
@@ -339,7 +339,7 @@ sub encode_client_response {
|
||||
next unless exists $versions->{$item};
|
||||
if ( ref($versions->{$item}) eq 'HASH' ) {
|
||||
my $mysql_versions = $versions->{$item};
|
||||
for my $id ( keys %$mysql_versions ) {
|
||||
for my $id ( sort keys %$mysql_versions ) {
|
||||
push @lines, join(';', $id, $item, $mysql_versions->{$id});
|
||||
}
|
||||
}
|
||||
|
@@ -388,7 +388,7 @@ SKIP: {
|
||||
}
|
||||
],
|
||||
# client should POST this
|
||||
post => "$master_id;MySQL;$mysql_ver $mysql_distro\n$slave1_id;MySQL;$mysql_ver $mysql_distro\n",
|
||||
post => "$slave1_id;MySQL;$mysql_ver $mysql_distro\n$master_id;MySQL;$mysql_ver $mysql_distro\n",
|
||||
# Server should return these suggetions after the client posts
|
||||
sug => [
|
||||
'Percona Server is fast.',
|
||||
|
@@ -79,9 +79,10 @@ system("$cmd --daemonize -D test --update --run-time 3s --pid $pid_file 1>/dev/n
|
||||
$output = `$ps_grep_cmd`;
|
||||
like($output, qr/$cmd/, 'It is running');
|
||||
|
||||
PerconaTest::wait_for_files($pid_file);
|
||||
ok(-f $pid_file, 'PID file created');
|
||||
my ($pid) = $output =~ /^\s*(\d+)\s+/;
|
||||
$output = `cat $pid_file`;
|
||||
$output = `cat $pid_file` if -f $pid_file;
|
||||
is($output, $pid, 'PID file has correct PID');
|
||||
|
||||
$output = `$cmd -D test --monitor --run-time 1s`;
|
||||
|
Reference in New Issue
Block a user