diff --git a/tool/tctl/common/helpers_test.go b/tool/tctl/common/helpers_test.go index 9470a6ee52f0e..795d0b1b8a707 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 }