mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-17 17:27:57 +00:00
PR-471 - Support adding explain output for slow query in JSON report as well
- Put fix into the proper place - Added test cases
This commit is contained in:
@@ -45,6 +45,27 @@ ok(
|
||||
),
|
||||
'Analysis for slow007 with --explain, no rows',
|
||||
);
|
||||
|
||||
# output=json
|
||||
|
||||
SKIP: {
|
||||
skip "output=json tests require 5.7" unless $sandbox_version ge '5.7';
|
||||
my $jq = `which jq`;
|
||||
chomp $jq;
|
||||
skip "output=json tests require jq" unless -x "$jq";
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_query_digest::main(@args, '--output=json',
|
||||
"$trunk/t/lib/samples/slowlogs/slow007.txt") },
|
||||
( $sandbox_version ge '8.0' ? "t/pt-query-digest/samples/slow007_explain_json_1-80.txt"
|
||||
: "t/pt-query-digest/samples/slow007_explain_json_1-57.txt"),
|
||||
post_pipe => 'jq -S .',
|
||||
),
|
||||
'Analysis for slow007 with --explain and --output=json, no rows',
|
||||
);
|
||||
}
|
||||
|
||||
# Normalish output from EXPLAIN.
|
||||
$dbh->do("insert into trees values ('apple'),('orange'),('banana')");
|
||||
|
||||
@@ -60,6 +81,26 @@ ok(
|
||||
'Analysis for slow007 with --explain',
|
||||
);
|
||||
|
||||
# output=json
|
||||
|
||||
SKIP: {
|
||||
skip "output=json tests require 5.7" unless $sandbox_version ge '5.7';
|
||||
my $jq = `which jq`;
|
||||
chomp $jq;
|
||||
skip "output=json tests require jq" unless -x "$jq";
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_query_digest::main(@args, '--output=json',
|
||||
"$trunk/t/lib/samples/slowlogs/slow007.txt") },
|
||||
( $sandbox_version ge '8.0' ? "t/pt-query-digest/samples/slow007_explain_json_2-80.txt"
|
||||
: "t/pt-query-digest/samples/slow007_explain_json_2-57.txt"),
|
||||
post_pipe => 'jq -S .',
|
||||
),
|
||||
'Analysis for slow007 with --explain and --output=json',
|
||||
);
|
||||
}
|
||||
|
||||
# #############################################################################
|
||||
# Issue 1141: Add "spark charts" to mk-query-digest profile
|
||||
# #############################################################################
|
||||
|
Reference in New Issue
Block a user