Skip to content

Commit

Permalink
fix(style): add information to test fail
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahhoward committed Sep 28, 2021
1 parent f32ba96 commit 505ed8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions requestmanager/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ func (e *Executor) onNewBlock(rt RequestTask, block graphsync.BlockData) error {

func (e *Executor) advanceTraversal(rt RequestTask, result types.AsyncLoadResult) error {
if result.Err != nil {
// before processing result check for context cancel to avoid sending an additional error
select {
case <-rt.Ctx.Done():
return ipldutil.ContextCancelError{}
default:
}
select {
case <-rt.Ctx.Done():
return ipldutil.ContextCancelError{}
Expand Down
4 changes: 2 additions & 2 deletions testutil/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ func VerifySingleTerminalError(ctx context.Context, t TestingT, errChan <-chan e
var err error
AssertReceive(ctx, t, errChan, &err, "should receive an error")
select {
case _, ok := <-errChan:
require.False(t, ok, "shouldn't have sent second error but did")
case secondErr, ok := <-errChan:
require.Falsef(t, ok, "shouldn't have sent second error but sent: %s, %s", err, secondErr)
case <-ctx.Done():
t.Fatal("errors not closed")
}
Expand Down

0 comments on commit 505ed8d

Please sign in to comment.