From 1bdcd18bf666ba308f71d8741e55147b122cb512 Mon Sep 17 00:00:00 2001 From: cyclinder Date: Wed, 8 Feb 2023 21:40:21 +0800 Subject: [PATCH] close grpc server in test file to avoid goroutine leak Signed-off-by: cyclinder --- pkg/kubelet/pluginmanager/reconciler/reconciler_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/kubelet/pluginmanager/reconciler/reconciler_test.go b/pkg/kubelet/pluginmanager/reconciler/reconciler_test.go index 8790c94333c..976eac82e9c 100644 --- a/pkg/kubelet/pluginmanager/reconciler/reconciler_test.go +++ b/pkg/kubelet/pluginmanager/reconciler/reconciler_test.go @@ -198,6 +198,9 @@ func Test_Run_Positive_Register(t *testing.T) { pluginName := fmt.Sprintf("example-plugin") p := pluginwatcher.NewTestExamplePlugin(pluginName, registerapi.DevicePlugin, socketPath, supportedVersions...) require.NoError(t, p.Serve("v1beta1", "v1beta2")) + defer func() { + require.NoError(t, p.Stop()) + }() timestampBeforeRegistration := time.Now() dsw.AddOrUpdatePlugin(socketPath) waitForRegistration(t, socketPath, timestampBeforeRegistration, asw)