kubernetes/test
Patrick Ohly f131cabfa0 test: use go-uber/goleak for strict leak checking
It provides more readable output and has additional APIs for using it inside a
unit test. goleak.IgnoreCurrent is needed to filter out the goroutine that gets
started when importing go.opencensus.io/stats/view.

In order to handle background goroutines that get created on demand and cannot
be stopped (like the one for LogzHealth), a helper function ensures that those
are running before calling goleak.IgnoreCurrent. Keeping those goroutines
running is not a problem and thus not worth the effort of adding new APIs to
stop them.

Other goroutines are genuine leaks for which no fix is available. Those get
suppressed via IgnoreTopFunction, which works as long as that function
is unique enough.

Example output for the leak fixed in https://github.com/kubernetes/kubernetes/pull/115423:

    E0202 09:30:51.641841   74789 etcd.go:205] "EtcdMain goroutine check" err=<
        found unexpected goroutines:
        [Goroutine 4889 in state chan receive, with k8s.io/apimachinery/pkg/watch.(*Broadcaster).loop on top of the stack:
        goroutine 4889 [chan receive]:
        k8s.io/apimachinery/pkg/watch.(*Broadcaster).loop(0xc0076183c0)
        	/nvme/gopath/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/watch/mux.go:268 +0x65
        created by k8s.io/apimachinery/pkg/watch.NewBroadcaster
        	/nvme/gopath/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/watch/mux.go:77 +0x116
    >
2023-02-14 12:11:37 +01:00
..
cmd Merge pull request #115579 from ardaguclu/fix-wait-sh-timeout 2023-02-10 13:59:29 -08:00
conformance remove conformance tested endpoints 2023-02-08 11:55:44 +13:00
e2e Merge pull request #115678 from pohly/e2e-full-reports 2023-02-10 15:07:29 -08:00
e2e_kubeadm e2e: use Ginkgo context 2022-12-16 20:14:04 +01:00
e2e_node Allow SSH e2e node base64 key injection 2023-02-09 16:17:11 +01:00
fixtures Updating pause image refernces to 3.9 2022-11-14 10:24:54 -08:00
fuzz
images [go] Bump images, dependencies and versions to go 1.20 2023-02-03 22:55:24 +01:00
instrumentation scheduler: promote pod resource metrics to stable 2023-02-09 20:30:45 +01:00
integration test: use go-uber/goleak for strict leak checking 2023-02-14 12:11:37 +01:00
kubemark Drop unsupported iks configuration for kubemark 2022-09-25 17:33:22 -04:00
list
soak/serve_hostnames fix typos 2022-06-15 13:38:48 +09:00
typecheck Avoid typechecking stdlib 2023-01-28 23:32:50 -05:00
utils etcd: Update to version 3.5.7 2023-01-27 17:24:00 +01:00
OWNERS test/OWNERS: add pohly as approver 2023-01-09 09:54:10 +01:00