mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-28 00:21:56 +00:00
Added JSONReportFormatter, a subclass of QueryReportFormatter that does what it says on the tin. WIP as it does not report profile or prepared statement data yet
This commit is contained in:
51
t/pt-query-digest/output.t
Normal file
51
t/pt-query-digest/output.t
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/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;
|
||||
|
||||
use PerconaTest;
|
||||
require "$trunk/bin/pt-query-digest";
|
||||
|
||||
my @args = qw(--output json);
|
||||
my $sample = "$trunk/t/lib/samples";
|
||||
my $results = "t/pt-query-digest/samples";
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_query_digest::main(@args, "$sample/slowlogs/empty") },
|
||||
"$results/empty_report.txt",
|
||||
),
|
||||
'json output for empty log'
|
||||
);
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_query_digest::main(@args, "$sample/slowlogs/slow002.txt") },
|
||||
"$results/output_json_slow002.txt"
|
||||
),
|
||||
'json output for slow002'
|
||||
);
|
||||
|
||||
# --type tcpdump
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_query_digest::main(qw(--type tcpdump --limit 10 --watch-server 127.0.0.1:12345),
|
||||
@args, "$sample/tcpdump/tcpdump021.txt") },
|
||||
"$results/output_json_tcpdump021.txt",
|
||||
),
|
||||
'json output for for tcpdump021',
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
done_testing;
|
Reference in New Issue
Block a user