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++
// send one and only one error per received address
errChan <- err
select {
case errChan <- err:
case <-ctx.Done():
return
}
case <-ctx.Done():
return
}

View file

@ -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
}