diff --git a/t/090-external.t b/t/090-external.t index e8a8430a4..5946cf473 100644 --- a/t/090-external.t +++ b/t/090-external.t @@ -140,8 +140,9 @@ my $logarchive = '/tmp/test.'.$<.'.log'; unlink($logarchive); $job = Thruk::Utils::External::perl($c, { expr => 'my($rc, $out) = Thruk::Utils::IO::cmd(["'.$cat.'", "'.$tempfile.'"], {no_decode => 1}); print $out; return $rc;', background => 1, log_archive => $logarchive }); TestUtils::wait_for_job($job); +my $jobdir = $c->config->{'var_path'}."/jobs/".$job; ($out,$err,$time,$dir,$stash,$rc,$profile,$start,$end,$perl_res) = Thruk::Utils::External::get_result($c, $job); -is(length($out), 10260038, "output ok"); +is(length($out), 10260038, "output ok") || TestUtils::bail_out_diag("job failed", `ls -la $jobdir`, `ls -la $logarchive`); is($err, "", "err output empty"); is($rc, 1, "exit code 1"); is($perl_res, 0, "perl result is 0"); diff --git a/t/TestUtils.pm b/t/TestUtils.pm index 83e709af8..45361d189 100644 --- a/t/TestUtils.pm +++ b/t/TestUtils.pm @@ -1114,6 +1114,31 @@ sub bail_out_cmd { return; } +######################### + +=head2 bail_out_diag + + print diagnostic output and bail out + +=cut +sub bail_out_diag { + my($msg, @details) = @_; + + diag("\n######################################################\n"); + chomp($msg); + diag($msg."\n"); + for my $d (@details) { + my $m = (ref $d ? Dumper($d) : $d); + chomp($m); + diag($m."\n"); + } + + diag(Carp::longmess("started here:")); + diag("\n######################################################\n"); + BAIL_OUT($msg); + return; +} + ######################### sub set_test_user_token { return if $test_token;