celestia-node
celestia-node copied to clipboard
testing: potential flake in TestService_Subscribe/subscription_cancellation
There may be a potential flake in this test, if blobs are buffered in the channel before the cancel method is called.
If this occurs, we can replace the original subCancel call with the following blurb and it should fix it.
The reason im not opening a PR immediately is because it may not even be a flake, so if it occurs again we can fix easily
// cancel the subscription context after receiving the last response
for range blobs {
select {
case val := <-subCh:
if val.Height == uint64(len(blobs)) {
subCancel()
}
case <-time.After(time.Second * 2):
t.Fatal("timeout waiting for subscription response")
}
}