Skip to content

Commit

Permalink
add endpoint validation output logging
Browse files Browse the repository at this point in the history
  • Loading branch information
k-rister committed Apr 26, 2024
1 parent 29ff8d4 commit d971716
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion rickshaw-run
Original file line number Diff line number Diff line change
Expand Up @@ -1763,6 +1763,7 @@ sub endpoint_validation_worker_thread() {
if (defined $job) {
debug_log(sprintf "Endpoint Validation Thread-%d got a job for %s, cmd is '%s'\n", $thread_idx, $job->{'endpoint'}, $job->{'command'});
(my $cmd, my $output, my $cmd_rc) = run_cmd($job->{'command'});
$endpoint_outputs->{$job->{'endpoint'}} = $output;
if ($cmd_rc > 0) {
printf "[ERROR] Endpoint " . $job->{'endpoint'} .
" validation returned non-zero exit code " . $cmd_rc . "\n" .
Expand All @@ -1772,7 +1773,6 @@ sub endpoint_validation_worker_thread() {
$job_errors_lock->up();
} else {
debug_log(sprintf "Endpoint %s validated\n", $job->{'endpoint'});
$endpoint_outputs->{$job->{'endpoint'}} = $output;
}
}
}
Expand Down Expand Up @@ -1856,6 +1856,21 @@ sub validate_endpoints() {
}
debug_log("Endpoint Validation Job processing complete\n");

# archive the endpoint validation output in the result directory
-e $run{'base-run-dir'} || mkdir($run{'base-run-dir'});
my $validations_dir = $run{'base-run-dir'} . "/validations";
mkdir($validations_dir);
foreach my $endpoint (@endpoints) {
my $validation_file = $validations_dir . "/" . $$endpoint{'label'} . ".txt";
if (open(EPV, ">", $validation_file)) {
print EPV $endpoint_outputs{$$endpoint{'label'}};
close EPV;
} else {
printf "ERROR: Could not open %s for writing!\n", $validation_file;
exit 1;
}
}

# wait and die here on validation error(s) so that we generate all
# the errors rather than just a subset
if ($job_errors > 0) {
Expand Down

0 comments on commit d971716

Please sign in to comment.