swarm/storage/localstore: stop sending to errChan on context done in tests

This commit is contained in:
Janos Guljas 2019-02-21 13:32:21 +01:00
parent 68f1e07f7e
commit 0b80043abb
2 changed files with 15 additions and 3 deletions

View file

@ -453,7 +453,11 @@ func readPullSubscriptionBin(ctx context.Context, bin uint8, ch <-chan ChunkDesc
} }
i++ i++
// send one and only one error per received address // send one and only one error per received address
errChan <- err select {
case errChan <- err:
case <-ctx.Done():
return
}
case <-ctx.Done(): case <-ctx.Done():
return return
} }

View file

@ -90,7 +90,11 @@ func TestDB_SubscribePush(t *testing.T) {
} }
i++ i++
// send one and only one error per received address // send one and only one error per received address
errChan <- err select {
case errChan <- err:
case <-ctx.Done():
return
}
case <-ctx.Done(): case <-ctx.Done():
return return
} }
@ -175,7 +179,11 @@ func TestDB_SubscribePush_multiple(t *testing.T) {
} }
i++ i++
// send one and only one error per received address // send one and only one error per received address
errChan <- err select {
case errChan <- err:
case <-ctx.Done():
return
}
case <-ctx.Done(): case <-ctx.Done():
return return
} }