tstest: simplify goroutine leak tests

Use tb.Cleanup to simplify both the API and the implementation.

One behavior change: When the number of goroutines shrinks, don't log.
I've never found these logs to be useful, and they frequently add noise.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
Josh Bleecher Snyder
2021-02-02 11:30:46 -08:00
committed by Josh Bleecher Snyder
parent 9a70789853
commit e8cd7bb66f
5 changed files with 34 additions and 82 deletions

View File

@@ -12,8 +12,7 @@ import (
)
func TestGetList(t *testing.T) {
rc := tstest.NewResourceCheck()
defer rc.Assert(t)
tstest.ResourceCheck(t)
pl, err := GetList(nil)
if err != nil {
@@ -26,8 +25,7 @@ func TestGetList(t *testing.T) {
}
func TestIgnoreLocallyBoundPorts(t *testing.T) {
rc := tstest.NewResourceCheck()
defer rc.Assert(t)
tstest.ResourceCheck(t)
ln, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {