diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-05-20 12:56:40 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-05-21 17:42:29 +0300 |
commit | 5eced00e6a636116c52ac6ed7628fa98dfe4045d (patch) | |
tree | aa156c9ea22ca1caf0401573480b301d0f66411a | |
parent | 0e96a90fdc8881561e7ec31b129df96015b82269 (diff) |
coordinator: Fix leaking gRPC Goroutines
Because we're not closing client connections in our coordinator tests,
we have lots of Goroutine leaks. This commit fixes at least two
locations, which brings the number of Goroutine leaks for the
`TestCoordinator_grpcErrorHandling()` test down to two. Maybe we're
lucky and this fixes the flakiness of the test.
-rw-r--r-- | internal/praefect/coordinator_test.go | 1 | ||||
-rw-r--r-- | internal/praefect/helper_test.go | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/internal/praefect/coordinator_test.go b/internal/praefect/coordinator_test.go index b0bee67d3..4242e9169 100644 --- a/internal/praefect/coordinator_test.go +++ b/internal/praefect/coordinator_test.go @@ -1477,6 +1477,7 @@ func TestCoordinator_grpcErrorHandling(t *testing.T) { grpc.WithDefaultCallOptions(grpc.ForceCodec(proxy.NewCodec())), }) require.NoError(t, err) + defer conn.Close() gitalies[gitaly] = gitalyNode{ mock: &nodes.MockNode{ diff --git a/internal/praefect/helper_test.go b/internal/praefect/helper_test.go index b9ee12476..caa15a98e 100644 --- a/internal/praefect/helper_test.go +++ b/internal/praefect/helper_test.go @@ -208,6 +208,8 @@ func runPraefectServer(t testing.TB, conf config.Config, opt buildOptions) (*grp cc := dialLocalPort(t, port, false) cleanup := func() { + cc.Close() + for _, cu := range cleanups { cu() } |