Skip to content

Commit

Permalink
error handling in execution (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
palashmarantas authored May 9, 2022
1 parent 10e4664 commit 68c781c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/testexecutionservice/testexecution.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,15 @@ func (tes *testExecutionService) Run(ctx context.Context,
tes.logger.Errorf("failed to find process for command %s with pid %d %v", cmd.String(), pid, err)
return nil, err
}
// not returning error because runner like jest will return error in case of test failure
// and we want to run test multiple times
if err := cmd.Wait(); err != nil {
err := cmd.Wait()
result := <-tes.ts.ExecutionResultOutputChannel
if err != nil {
tes.logger.Errorf("error in test execution: %+v", err)
// returning error when result is nil to throw execution errors like heap out of memory
if result == nil {
return nil, err
}
}
result := <-tes.ts.ExecutionResultOutputChannel
if result != nil {
executionResults.Results = append(executionResults.Results, result.Results...)
}
Expand Down

0 comments on commit 68c781c

Please sign in to comment.