Skip to content

Commit

Permalink
fix: handle context cancellations in txsim (#2830)
Browse files Browse the repository at this point in the history
I have seen a few CI tests fail because although the context stops the
process, it isn't correctly parsed causing the program that called the
txsim to think that there was another error and not the context Canceled
or DeadlineExceeded errors

(cherry picked from commit 5dfe777)
  • Loading branch information
cmwaters authored and mergify[bot] committed Nov 10, 2023
1 parent 77bf9e8 commit 816588d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/txsim/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,16 @@ func Run(
log.Info().Err(err).Msg("sequence terminated")
continue
}
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
continue
}
log.Error().Err(err).Msg("sequence failed")
finalErr = err
}

if ctx.Err() != nil {
return ctx.Err()
}

return finalErr
}

0 comments on commit 816588d

Please sign in to comment.