diff --git a/tool/tctl/common/helpers_test.go b/tool/tctl/common/helpers_test.go index 4e04929f7652f..934e5b66262ba 100644 --- a/tool/tctl/common/helpers_test.go +++ b/tool/tctl/common/helpers_test.go @@ -80,6 +80,13 @@ func getAuthClient(ctx context.Context, t *testing.T, fc *config.FileConfig, opt client, err := authclient.Connect(ctx, clientConfig) require.NoError(t, err) + + t.Cleanup(func() { + if closer, ok := client.(io.Closer); ok { + closer.Close() + } + }) + return client }