Skip to content

Commit

Permalink
Throw if fail
Browse files Browse the repository at this point in the history
  • Loading branch information
Luc45 committed Dec 23, 2024
1 parent d4c6e1a commit 438eba3
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions _tests/managed_tests/src/QitRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,9 @@ private function poll_tests( array $allTests ) {
$completed_tests = [];
$unknown_tests = [];

if ( json_last_error() !== JSON_ERROR_NONE || ! is_array( $result_json ) ) {
$this->logger->log( "get-multiple returned invalid JSON. Marking all as unknown." );
foreach ( $allTests as $tid => $test ) {
$this->liveOutput->setTestStatus( $tid, 'unknown' );
maybe_echo( "Failed to parse JSON for test_run_id {$tid}.\n" );
$unknown_tests[] = $tid;
}
if (json_last_error() !== JSON_ERROR_NONE || ! is_array($result_json)) {
$this->logger->log("get-multiple returned invalid JSON:\n" . $get_output);
throw new RuntimeException( "Failed to parse JSON from get-multiple. Raw output:\n" . $get_output . "\n Error output:\n . {$get_process->getErrorOutput()}" );
} else {
$this->logger->log( "get-multiple keys returned: " . implode( ',', array_keys( $result_json ) ) );
foreach ( $allTests as $tid => $test ) {
Expand Down

0 comments on commit 438eba3

Please sign in to comment.