Commit Graph

9 Commits (b91703de47c14f40de26801cfeb4c9d0736ce8b8)

Author SHA1 Message Date
Andrew Dunham b91703de47 tstest: ignore certain goroutines in ResourceCheck
On Unix platforms, it's possible that the net package will launch
goroutines that we cannot terminate and could live for an indeterminate
time; the stack looks like this:

  1 @ 0x43ae6e 0x81f72b 0x822392 0x82189d 0x8224a7 0x4a5d41
  #	0x81f72a	net._C2func_getaddrinfo+0x8a	_cgo_gotypes.go:94
  #	0x822391	net.cgoLookupIPCNAME.func1+0xb1	/go/1.19.2/x64/src/net/cgo_unix.go:160
  #	0x82189c	net.cgoLookupIPCNAME+0x27c	/go/1.19.2/x64/src/net/cgo_unix.go:160
  #	0x8224a6	net.cgoIPLookup+0x66		/go/1.19.2/x64/src/net/cgo_unix.go:217

In tests that do DNS lookups, it's possible that these goroutines will
result in a test flake. Rather than try to carefully shut those down,
just ignore them entirely when counting goroutines.

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I25907e29d1a6b43a95002e1b55208cb965b9bfa4
2022-11-03 16:39:13 -04:00
Maisem Ali 8fd5d3eaf3 tstest: do not error if the there are fewer goroutines than at start
This fixes test failures like:
```
    resource.go:34: goroutine count: expected 3, got 2
```

Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-07-29 09:53:01 -07:00
Brad Fitzpatrick 45e64f2e1a net/dns{,/resolver}: refactor DNS forwarder, send out of right link on macOS/iOS
Fixes #2224
Fixes tailscale/corp#2045

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-06-23 16:04:10 -07:00
Josh Bleecher Snyder e8cd7bb66f 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>
2021-02-03 13:06:40 -08:00
Josh Bleecher Snyder e1596d655a tstest: skip resource check when test has failed
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2020-10-01 11:27:22 -07:00
Josh Bleecher Snyder 2e40c4b564 tstest: don't log on success
This is particularly important for benchmarks,
where stray output disrupts tooling.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2020-09-08 15:18:36 -07:00
David Crawshaw 3baa084548 tstest: take testing.TB in helper for benchmarks
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-09-04 07:48:45 -04:00
Avery Pennarun e0b666c5d2 tstest.ResourceCheck: clarify success message.
Inclusion of the word "assert" made it seem like a failure, even though
it was supposed to be identifying the name of the function (Assert()).

Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
2020-05-13 23:02:32 -04:00
David Anderson 0038223632 tstest: rename from testy.
Signed-off-by: David Anderson <danderson@tailscale.com>
2020-04-28 20:45:12 -07:00