The previous test implementation was flaky. This change uses a channel to signal that the FlowDeleted path has been reached.
While the srv.Close() will prevent new connections, and the downloadHelper() closes the client connection, there is still an independent handler goroutine that reaches the FlowDeleted path after a short delay. Rather than using a larger static delay, this change sets a maximum delay and waits for the deleted channel to close, allowing the test to stop as quickly as it's able to.
The previous test implementation was flaky. This change uses a channel to signal that the
FlowDeleted
path has been reached.While the
srv.Close()
will prevent new connections, and thedownloadHelper()
closes the client connection, there is still an independent handler goroutine that reaches theFlowDeleted
path after a short delay. Rather than using a larger static delay, this change sets a maximum delay and waits for thedeleted
channel to close, allowing the test to stop as quickly as it's able to.This change is