mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-02-27 02:00:57 +08:00
(Whoops. Forgot to commit the changed tests)
This commit is contained in:
@@ -9,7 +9,9 @@ BEGIN {
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use English qw(-no_match_vars);
|
||||
use Test::More tests => 15;
|
||||
use Test::More tests => 16;
|
||||
|
||||
use File::Temp ();
|
||||
|
||||
use PerconaTest;
|
||||
require "$trunk/bin/pt-diskstats";
|
||||
@@ -44,8 +46,8 @@ sub test_diskstats_file {
|
||||
sub {
|
||||
tie local *STDIN, "Test";
|
||||
pt_diskstats::main(
|
||||
qw(--zero-rows --group-by), $groupby,
|
||||
'--columns','cnc|rt|mb|busy|prg',
|
||||
qw(--show-inactive --group-by), $groupby,
|
||||
'--columns-regex','cnc|rt|mb|busy|prg',
|
||||
$file);
|
||||
},
|
||||
"t/pt-diskstats/expected/${groupby}_int_$args{file}",
|
||||
@@ -64,25 +66,34 @@ foreach my $file ( map "diskstats-00$_.txt", 1..5 ) {
|
||||
# --save-samples and --iterations
|
||||
# ###########################################################################
|
||||
|
||||
# TODO: fix this one
|
||||
my ($fh, $tempfile) = File::Temp::tempfile( "pt-diskstats.test.$PID.XXXXXX", OPEN => 0);
|
||||
|
||||
#my $iterations = 2;
|
||||
#my $out = output( sub {
|
||||
# pt_diskstats::main(
|
||||
# "--group-by" => "all",
|
||||
# "--columns" => "cnc|rt|mb|busy|prg",
|
||||
# "--save-samples" => $tempfile,
|
||||
# "--iterations" => $iterations,
|
||||
# "--zero-rows",
|
||||
# );
|
||||
#});
|
||||
#
|
||||
#is(
|
||||
# $count,
|
||||
# $iterations,
|
||||
# "--save-samples and --iterations work"
|
||||
#);
|
||||
my $iterations = 2;
|
||||
my $out = output( sub {
|
||||
pt_diskstats::main(
|
||||
"--group-by" => "all",
|
||||
"--columns-regex" => "cnc|rt|mb|busy|prg",
|
||||
"--save-samples" => $tempfile,
|
||||
"--iterations" => $iterations,
|
||||
"--show-inactive",
|
||||
);
|
||||
});
|
||||
|
||||
open my $samples_fh, "<", $tempfile
|
||||
or die "Cannot open $tempfile: $OS_ERROR";
|
||||
|
||||
my $count;
|
||||
while (my $line = <$samples_fh>) {
|
||||
$count++ if $line =~ /^TS/;
|
||||
}
|
||||
|
||||
is(
|
||||
$count,
|
||||
$iterations,
|
||||
"--save-samples and --iterations work"
|
||||
);
|
||||
|
||||
1 while unlink $tempfile;
|
||||
|
||||
# ###########################################################################
|
||||
# Done.
|
||||
|
||||
Reference in New Issue
Block a user