diff --git a/swarm/storage/localstore/subscription_pull_test.go b/swarm/storage/localstore/subscription_pull_test.go index 03a19a2f7d..c8649bb834 100644 --- a/swarm/storage/localstore/subscription_pull_test.go +++ b/swarm/storage/localstore/subscription_pull_test.go @@ -453,7 +453,11 @@ func readPullSubscriptionBin(ctx context.Context, bin uint8, ch <-chan ChunkDesc } i++ // send one and only one error per received address - errChan <- err + select { + case errChan <- err: + case <-ctx.Done(): + return + } case <-ctx.Done(): return } diff --git a/swarm/storage/localstore/subscription_push_test.go b/swarm/storage/localstore/subscription_push_test.go index 73e7c25f72..f1a0df7a34 100644 --- a/swarm/storage/localstore/subscription_push_test.go +++ b/swarm/storage/localstore/subscription_push_test.go @@ -90,7 +90,11 @@ func TestDB_SubscribePush(t *testing.T) { } i++ // send one and only one error per received address - errChan <- err + select { + case errChan <- err: + case <-ctx.Done(): + return + } case <-ctx.Done(): return } @@ -175,7 +179,11 @@ func TestDB_SubscribePush_multiple(t *testing.T) { } i++ // send one and only one error per received address - errChan <- err + select { + case errChan <- err: + case <-ctx.Done(): + return + } case <-ctx.Done(): return }