gvisor
gvisor copied to clipboard
Use testing.synctest to ensure all goroutines exit before checking memory leaks in tcp e2e tests
Solves #5940
Existing tcp e2e tests use a time.Sleep call to guarantee that all spawned goroutines get cleaned up before running a leak check. This PR instead uses synctest.Test on each testcase with a synctest.Wait() call to guarantee that test case goroutines don't exit until all child goroutines are cleaned up.
This was done with the following script: https://gist.github.com/uzairnawaz/d8a891c2a8072690e180a1027c69f90f