mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 13:40:07 +00:00
Merge pull request #43 from percona/pt-kill-option-filter-does-not-work-lp1488685
pt-kill option --filter does not work (LP bug 1488685)
This commit is contained in:
@@ -7055,6 +7055,8 @@ sub main {
|
|||||||
$filtered_proclist = $proclist;
|
$filtered_proclist = $proclist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$proclist = $filtered_proclist;
|
||||||
|
|
||||||
my @queries;
|
my @queries;
|
||||||
if ( $proclist ) {
|
if ( $proclist ) {
|
||||||
# ##################################################################
|
# ##################################################################
|
||||||
|
42
t/pt-kill/filter_plugin.t
Normal file
42
t/pt-kill/filter_plugin.t
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
|
||||||
|
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
|
||||||
|
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
|
||||||
|
};
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings FATAL => 'all';
|
||||||
|
use English qw(-no_match_vars);
|
||||||
|
use Test::More tests => 1;
|
||||||
|
|
||||||
|
use PerconaTest;
|
||||||
|
use Sandbox;
|
||||||
|
require "$trunk/bin/pt-kill";
|
||||||
|
|
||||||
|
my $sample = "$trunk/t/lib/samples/pl";
|
||||||
|
my $filter = "$trunk/t/pt-kill/samples";
|
||||||
|
my @args = qw(--test-matching);
|
||||||
|
my $output;
|
||||||
|
|
||||||
|
# #############################################################################
|
||||||
|
# Basic filter
|
||||||
|
# #############################################################################
|
||||||
|
|
||||||
|
$output = output(
|
||||||
|
sub { pt_kill::main(@args, "$sample/recset010.txt",
|
||||||
|
'--filter', "$filter/filter002.txt",
|
||||||
|
qw(--match-all),
|
||||||
|
qw(--victims all --print)); }
|
||||||
|
);
|
||||||
|
|
||||||
|
ok(
|
||||||
|
$output =~ /foo/m && $output !~ /bar/s,
|
||||||
|
"basic --filter function works"
|
||||||
|
);
|
||||||
|
|
||||||
|
# #############################################################################
|
||||||
|
# Done.
|
||||||
|
# #############################################################################
|
||||||
|
exit;
|
2
t/pt-kill/samples/filter002.txt
Normal file
2
t/pt-kill/samples/filter002.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
defined($event->{Info}) && $event->{Info} =~ /select.*foo/
|
||||||
|
|
Reference in New Issue
Block a user