Fix for 1035311: pt-diskstats shows wrong device name

This commit is contained in:
Brian Fraser
2012-08-10 15:36:34 -03:00
parent 4510cc4b28
commit c08c0c6a7a
9 changed files with 1642 additions and 11 deletions

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 108;
use Test::More;
use PerconaTest;
@@ -518,7 +518,7 @@ for my $test (
ok(
no_diff(
sub {
open my $fh, "<", $file_with_trunk or die $!;
open my $fh, "<", $file_with_trunk or die $!; # "<">"
$obj->group_by(filehandle => $fh);
},
$expected,
@@ -574,7 +574,33 @@ EOF
}
# ###########################################################################
# --group-by sample + --devices-regex show the wrong device
# https://bugs.launchpad.net/percona-toolkit/+bug/1035311
# ###########################################################################
my $sample_obj = DiskstatsGroupBySample->new( OptionParser => $o, devices_regex => qr/./ );
$sample_obj->ordered_devs( [ "aaaa", "bbbb" ] );
for (
[ 1, "aaaa", "with 1 dev shows the first device" ],
[ 5, "{5}", 'with 5 devs shows "{5}"'],
[ 2, "{2}", 'with 2 devs shows "{2}"' ],
[ 1, "bbbb", 'with 1 devs and a filtering devices_regex, shows "bbbb"'],
)
{
my ($num_devs, $expected, $test) = @$_;
is(
$sample_obj->compute_dev($num_devs),
$expected,
"DiskstatsGroupBySample->compute_dev $test"
);
# After the first iteration, change the
$sample_obj->set_devices_regex(qr/^bbbb/);
}
# ###########################################################################
# Done.
# ###########################################################################
exit;
done_testing;