celestia-node icon indicating copy to clipboard operation
celestia-node copied to clipboard

testing: potential flake in TestService_Subscribe/subscription_cancellation

Open distractedm1nd opened this issue 6 months ago • 0 comments

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")
			}
		}

distractedm1nd avatar Aug 02 '24 11:08 distractedm1nd