diff --git a/tool/tctl/common/helpers_test.go b/tool/tctl/common/helpers_test.go index 252b9295730a3..de434c6fc8b9b 100644 --- a/tool/tctl/common/helpers_test.go +++ b/tool/tctl/common/helpers_test.go @@ -85,6 +85,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 }