Skip to content

Commit

Permalink
goleak: ignore rules_go SIGTERM handler
Browse files Browse the repository at this point in the history
rules_go added a SIGTERM handler that has a goroutine that survives the scope of the goleak check.
Currently, the best known workaround is to ignore this goroutine.

uber-go/goleak#119
bazelbuild/rules_go#3749
bazelbuild/rules_go#3827 (comment)
  • Loading branch information
malt3 committed Jan 16, 2024
1 parent 367d9c7 commit 0bd35a0
Show file tree
Hide file tree
Showing 67 changed files with 67 additions and 55 deletions.
2 changes: 1 addition & 1 deletion bootstrapper/internal/clean/clean_test.go
Expand Up @@ -16,7 +16,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestNew(t *testing.T) {
Expand Down
Expand Up @@ -18,7 +18,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestUpdatePassphrase(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions bootstrapper/internal/initserver/initserver_test.go
Expand Up @@ -38,6 +38,7 @@ func TestMain(m *testing.M) {
goleak.VerifyTestMain(m,
// https://github.com/census-instrumentation/opencensus-go/issues/1262
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"),
)
}

Expand Down
2 changes: 1 addition & 1 deletion bootstrapper/internal/joinclient/joinclient_test.go
Expand Up @@ -35,7 +35,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestClient(t *testing.T) {
Expand Down
Expand Up @@ -18,7 +18,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestInitConfiguration(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion bootstrapper/internal/kubernetes/kubernetes_test.go
Expand Up @@ -30,7 +30,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestInitCluster(t *testing.T) {
Expand Down
Expand Up @@ -17,7 +17,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestCloudKubeAPIWaiter(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions cli/internal/cloudcmd/clients_test.go
Expand Up @@ -23,6 +23,7 @@ func TestMain(m *testing.M) {
goleak.VerifyTestMain(m,
// https://github.com/census-instrumentation/opencensus-go/issues/1262
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"),
)
}

Expand Down
1 change: 1 addition & 0 deletions cli/internal/cmd/cloud_test.go
Expand Up @@ -23,6 +23,7 @@ func TestMain(m *testing.M) {
goleak.VerifyTestMain(m,
// https://github.com/census-instrumentation/opencensus-go/issues/1262
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"),
)
}

Expand Down
2 changes: 1 addition & 1 deletion cli/internal/terraform/terraform_test.go
Expand Up @@ -30,7 +30,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestPrepareCluster(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion csi/cryptmapper/cryptmapper_test.go
Expand Up @@ -18,7 +18,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestCloseCryptDevice(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion csi/kms/constellation_test.go
Expand Up @@ -19,7 +19,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

type stubKMSClient struct {
Expand Down
2 changes: 1 addition & 1 deletion csi/test/mount_integration_test.go
Expand Up @@ -91,7 +91,7 @@ func TestMain(m *testing.M) {
os.Exit(1)
}

goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))

result := m.Run()
os.Exit(result)
Expand Down
1 change: 1 addition & 0 deletions debugd/internal/debugd/deploy/download_test.go
Expand Up @@ -27,6 +27,7 @@ func TestMain(m *testing.M) {
goleak.VerifyTestMain(m,
// https://github.com/census-instrumentation/opencensus-go/issues/1262
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"),
)
}

Expand Down
Expand Up @@ -22,6 +22,7 @@ func TestMain(m *testing.M) {
goleak.VerifyTestMain(m,
// https://github.com/census-instrumentation/opencensus-go/issues/1262
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"),
)
}

Expand Down
2 changes: 1 addition & 1 deletion debugd/internal/debugd/metadata/fallback/fallback_test.go
Expand Up @@ -16,7 +16,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestDiscoverDebugdIPs(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion debugd/internal/debugd/metadata/scheduler_test.go
Expand Up @@ -19,7 +19,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestSchedulerStart(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion debugd/internal/debugd/server/server_test.go
Expand Up @@ -29,7 +29,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestSetInfo(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion debugd/internal/filetransfer/filetransfer_test.go
Expand Up @@ -20,7 +20,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestSendFiles(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion debugd/internal/filetransfer/streamer/streamer_test.go
Expand Up @@ -19,7 +19,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestWriteStream(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions disk-mapper/internal/recoveryserver/recoveryserver_test.go
Expand Up @@ -29,6 +29,7 @@ func TestMain(m *testing.M) {
goleak.VerifyTestMain(m,
// https://github.com/census-instrumentation/opencensus-go/issues/1262
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"),
)
}

Expand Down
2 changes: 1 addition & 1 deletion disk-mapper/internal/rejoinclient/rejoinclient_test.go
Expand Up @@ -30,7 +30,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestStartCancel(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion disk-mapper/internal/setup/setup_test.go
Expand Up @@ -28,7 +28,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestPrepareExistingDisk(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion disk-mapper/internal/systemd/systemd_test.go
Expand Up @@ -14,7 +14,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestConfigureUnit(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions disk-mapper/internal/test/integration_test.go
Expand Up @@ -87,6 +87,7 @@ func TestMain(m *testing.M) {
goleak.VerifyTestMain(m,
// https://github.com/census-instrumentation/opencensus-go/issues/1262
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"),
)

result := m.Run()
Expand Down
2 changes: 1 addition & 1 deletion hack/bazel-deps-mirror/internal/bazelfiles/files_test.go
Expand Up @@ -18,7 +18,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestFindFiles(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion hack/bazel-deps-mirror/internal/issues/issues_test.go
Expand Up @@ -16,7 +16,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestMap(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion hack/bazel-deps-mirror/internal/mirror/mirror_test.go
Expand Up @@ -24,7 +24,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestMirrorURL(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion hack/bazel-deps-mirror/internal/rules/rules_test.go
Expand Up @@ -16,7 +16,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestRules(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion image/measured-boot/extract/extract_test.go
Expand Up @@ -19,7 +19,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestPeSectionReader(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion image/measured-boot/measure/measure_test.go
Expand Up @@ -13,5 +13,5 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}
2 changes: 1 addition & 1 deletion internal/api/versionsapi/fetcher_test.go
Expand Up @@ -21,7 +21,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestFetchVersionList(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/atls/atls_test.go
Expand Up @@ -22,7 +22,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestTLSConfig(t *testing.T) {
Expand Down
Expand Up @@ -13,5 +13,5 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}
2 changes: 1 addition & 1 deletion internal/attestation/vtpm/vtpm_test.go
Expand Up @@ -13,5 +13,5 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}
2 changes: 1 addition & 1 deletion internal/cloud/aws/logger_test.go
Expand Up @@ -28,7 +28,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestCreateStream(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/cloud/azure/azure_test.go
Expand Up @@ -24,7 +24,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestGetInstance(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/cloud/azureshared/appcredentials_test.go
Expand Up @@ -16,7 +16,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestApplicationCredentialsFromURI(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions internal/cloud/gcp/gcp_test.go
Expand Up @@ -27,6 +27,7 @@ func TestMain(m *testing.M) {
goleak.VerifyTestMain(m,
// https://github.com/census-instrumentation/opencensus-go/issues/1262
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"),
)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/config/config_test.go
Expand Up @@ -34,7 +34,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestDefaultConfig(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/crypto/crypto_test.go
Expand Up @@ -17,7 +17,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestDeriveKey(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/file/file_test.go
Expand Up @@ -21,7 +21,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestWrite(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/grpc/atlscredentials/atlscredentials_test.go
Expand Up @@ -25,7 +25,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestATLSCredentials(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/grpc/dialer/dialer_test.go
Expand Up @@ -22,7 +22,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestDial(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/imagefetcher/imagefetcher_test.go
Expand Up @@ -24,7 +24,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestGetReference(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/kms/kms/cluster/cluster_test.go
Expand Up @@ -18,7 +18,7 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/bazelbuild/rules_go/go/tools/bzltestutil.RegisterTimeoutHandler.func1"))
}

func TestClusterKMS(t *testing.T) {
Expand Down

0 comments on commit 0bd35a0

Please sign in to comment.