ream = *set_use_stream;
*test_args = *args;
*set_test_args = *set_args;
}
sub TO_JSON { +{%{$_[0]}, class => blessed($_[0])} }
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Test2:
004';
use Carp qw/croak/;
use Time::HiRes qw/sleep time/;
use Test2::Harness::Util::JSON qw/encode_json encode_json/;
use parent 'Plack::Response';
use Importer Importer => 'import';
our %EXPORT_AN
}) {
$data = $go->$meth();
}
my $out = encode_json($data) . "\n";
return $out;
};
}
else {
$
$self->{errors} ||= []} => @_;
return;
}
sub as_json {
my $self = shift;
my (%inject) = @_;
$self->content_type('application/json');
my $data = {
%inject,
messag
s format_uuid_for_db/;
use Test2::Util::UUID qw/gen_uuid/;
use Test2::Harness::Util::JSON qw/encode_json decode_json/;
use App::Yath::Schema::ImportModes qw{
%MODES
record_all_events
even
nect} = 1 if $App::Yath::Schema::LOADED =~ m/(mysql|percona|maraidb)/i;
}
my $e = decode_json(scalar $line);
my $f = $e->{facet_data};
my $self;
my ($run_id, $run_uuid);
if (
{
my ($line, $idx) = @_;
return if eval {
my $e = decode_json($line);
$self->process_event($e, undef, $idx);
1;
};
gzip, or
compressed in bzip2.
=head1 FORMAT
The log file is in jsonl format. Each line of the log can be indepentantly
parsed as json. Each line represents a single event Test2::Harness processed
du
different
processes. A complete log will be terminated by the string C<null>, which is
also valid json. If a log is missing this terminator it is considered an
incomplete log.
=head2 EVENTS
B<Please
se POSIX qw/strftime/;
use Test2::Harness::Util qw/clean_path/;
use Test2::Harness::Util::JSON qw/encode_json/;
use parent 'App::Yath::Renderer';
use Test2::Harness::Util::HashBase qw{
<file
[qw/YATH_LOG_FILE_FORMAT TEST2_HARNESS_LOG_FORMAT/],
default => '%!P%Y-%m-%d_%H:%M:%S_%!U.jsonl',
description => 'Specify the format for automatically-generated log files. Overridden
mplies -L (Default: \$YATH_LOG_FILE_FORMAT, if that is set, or else "%!P%Y-%m-%d~%H:%M:%S~%!U~%!p.jsonl"). This is a string in which percent-escape sequences will be replaced as per POSIX::strftime. T
::Harness::Util qw/hub_truth apply_encoding mod2file fqmod/;
use Test2::Harness::Util::JSON qw/encode_pretty_json/;
use File::Spec();
use IO::Handle;
use Scalar::Util qw/blessed/;
use Storable qw/dcl
sh @{$f->{info}} => {
tag => 'RUN INFO',
details => encode_pretty_json($run),
};
}
if ($self->{+SHOW_RUN_FIELDS}) {
if (my $fields = $f->{harne
fo}} => {
tag => 'RUN FLD',
details => encode_pretty_json($field),
};
}
}
}
if ($f->{harness_job_launch}) {
use Test2::Harness::IPC::Util qw/start_process/;
use Test2::Harness::Util::JSON qw/encode_json_file encode_json decode_json_file/;
use Test2::Util::UUID qw/gen_uuid/;
use parent 'App::Yath::Renderer
project;
my $project;
if (my $meta_json = find_in_updir('META.json')) {
my $json = decode_json_file($meta_json);
$project = $json->{name};
}
elsif (my $meta_yml = fin
cessor->process_csnb(
Getopt::Yath::Settings->FROM_JSON_FILE(\$ARGV[0], unlink => 1),
)
);
EOT
encode_json_file($self->{+SETTINGS}), # Pass settings
::Notify;
use strict;
use warnings;
our $VERSION = '2.000004';
use Test2::Harness::Util::JSON qw/encode_json/;
use Test2::Harness::Util qw/mod2file/;
use Sys::Hostname qw/hostname/;
use Carp qw/cr
rl,
{
headers => {'content-type' => 'application/json'},
content => encode_json({channel => $dest, text => $text}),
},
);
warn "
e Test2::Harness::Util qw/mod2file write_file_atomic/;
use Test2::Harness::Util::JSON qw/encode_json encode_pretty_json/;
use Test2::Util::UUID qw/gen_uuid/;
use Test2::Harness::IPC::Util qw/set_procn
>dismiss();
kill($sig, $$);
};
}
die "API Failure: " . encode_pretty_json($res->{api})
unless $res->{api}->{success};
my $lf = Test2::Harness::Util::LogFile->
tter;
use strict;
use warnings;
our $VERSION = '2.000004';
use Test2::Harness::Util::JSON qw/encode_pretty_json/;
use Test2::Harness::Util qw/mod2file fqmod/;
use Storable qw/dclone/;
use Getopt::Y
sh @{$f->{info}} => {
tag => 'RUN INFO',
details => encode_pretty_json($run),
};
}
if ($self->{+SHOW_RUN_FIELDS}) {
if (my $fields = $f->{harne
fo}} => {
tag => 'RUN FLD',
details => encode_pretty_json($field),
};
}
}
}
if ($f->{harness_job_launch}) {
::Term qw/USE_COLOR/;
use Test2::Harness::Util qw/clean_path/;
use Test2::Harness::Util::JSON qw/json_true json_false/;
use List::Util qw/max/;
our $VERSION = '2.000004';
use parent 'App::Yath::Ren
,
autofill => sub { 'summary.json' },
description => "Write out a summary json file, if no path is provided 'summary.json' will be used. The .json extension is added automatically if
long_examples => ['', '=/path/to/summary.json'],
normalize => sub {
my $val = shift;
$val .= '.json' unless $val =~ m/\.json$/;
return clean_path($val);
ase qw/-config -worker_id/;
use Test2::Util::UUID qw/gen_uuid/;
use Test2::Harness::Util::JSON qw/decode_json/;
use IO::Uncompress::Bunzip2 qw($Bunzip2Error);
use IO::Uncompress::Gunzip qw($GunzipE
next if $line =~ m/^null$/ims;
my $ln = $.;
my $error = $self->process_event_json($processor, $ln => $line) or next;
push @errors => "error processing line number $ln: $er
return $status;
}
sub process_event_json {
my $self = shift;
my ($processor, $ln, $json) = @_;
my $ok = eval {
my $event = decode_json($json);
$processor->process_event(
qw{
-_schema
<dbi_dsn <dbi_user <dbi_pass
<ephemeral
<ephemeral_stack
};
sub TO_JSON {
my $self = shift;
my %data = %$self;
delete $data{+_SCHEMA};
delete $data{+EPH
parent 'DBIx::Class::Core';
*get_all_fields = __PACKAGE__->can('get_inflated_columns');
sub TO_JSON {
my $self = shift;
my %cols = $self->get_all_fields;
return \%cols;
}
1;
__END__
lt => 0,
description => "When using staged preload, dump the depmap for each stage as json files",
);
option reload_in_place => (
type => 'Bool',
alt
ons::Run;
use strict;
use warnings;
our $VERSION = '2.000004';
use Test2::Harness::Util::JSON qw/decode_json/;
use Test2::Util::UUID qw/gen_uuid/;
use Test2::Harness::Util qw/fqmod/;
use List::Util
"Add custom data to the harness run",
normalize => sub { m/^\s*\{.*\}\s*$/s ? decode_json($_[0]) : {mesh(['name', 'details'], [split /[=]/, $_[0]])} },
);
option run_id => (
=> ['', '=path/to/log.jsonl', '=plugin_specific_string'],
autofill => sub {
my $log = first { -e $_ } qw{ ./lastlog.jsonl ./lastlog.jsonl.bz2 ./lastlog.jsonl.gz };
re
ples => [' file.json', ' http://example.com/durations.json'],
short_examples => [' file.json', ' http://example.com/durations.json'],
description => "Point at a json file or url whic
ples => [' file.json', ' http://example.com/durations.json'],
short_examples => [' file.json', ' http://example.com/durations.json'],
description => "Point at a json file or url whic
s::Util qw/mod2file parse_exit open_file chmod_tmp/;
use Test2::Harness::Util::JSON qw/decode_json encode_json decode_json_file/;
use Test2::Harness::IPC::Util qw/pid_is_running swap_io start_process
encode_json($_) . "\n" for @_ };
}
elsif ($self->{+OUTPUT}->isa('Atomic::Pipe')) {
my $wp = $self->{+OUTPUT};
$self->{+OUTPUT_CB} = sub { $wp->write_message(encode_json($_)) f
= @_;
if ($in =~ m/\.json$/ || -f $in) {
%params = %{decode_json_file($in, unlink => 1)};
}
else {
%params = %{decode_json($in)};
}
}
e
l qw/start_collected_process ipc_connect set_procname/;
use Test2::Harness::Util::JSON qw/decode_json_file encode_json_file/;
use Test2::Util::UUID qw/gen_uuid/;
use Test2::Harness::Util::HashBase qw
_subprocess_run(\$ARGV[0]))", # Run it.
encode_json_file({parent_pid => $$, $self->subprocess_args}), # json data
);
}
sub spawn_process {
my $self = shift;
my %pa
rocess_run {
my $class = shift;
my ($json_file) = @_;
STDOUT->autoflush(1);
STDERR->autoflush(1);
my $params = decode_json_file($json_file);
set_procname(set => ['resource',
use Test2::Harness::IPC::Util qw/pid_is_running set_procname/;
use Test2::Harness::Util::JSON qw/decode_json/;
use parent 'App::Yath::Command';
use Test2::Harness::Util::HashBase qw{
+client