diff --git a/receiver/k8sclusterreceiver/factory_test.go b/receiver/k8sclusterreceiver/factory_test.go index 51242257294c..a50d2e7dae2c 100644 --- a/receiver/k8sclusterreceiver/factory_test.go +++ b/receiver/k8sclusterreceiver/factory_test.go @@ -59,6 +59,7 @@ func TestFactory(t *testing.T) { rCfg.MetadataExporters = []string{"nop/withoutmetadata"} r = newTestReceiver(t, rCfg) require.Error(t, r.Start(context.Background(), newNopHostWithExporters())) + require.NoError(t, r.Shutdown(context.Background())) } func TestFactoryDistributions(t *testing.T) { @@ -74,6 +75,7 @@ func TestFactoryDistributions(t *testing.T) { err := r.Start(context.Background(), newNopHost()) require.NoError(t, err) require.Nil(t, r.resourceWatcher.osQuotaClient) + require.NoError(t, r.Shutdown(context.Background())) // openshift rCfg.Distribution = "openshift" @@ -81,6 +83,7 @@ func TestFactoryDistributions(t *testing.T) { err = r.Start(context.Background(), newNopHost()) require.NoError(t, err) require.NotNil(t, r.resourceWatcher.osQuotaClient) + require.NoError(t, r.Shutdown(context.Background())) } func newTestReceiver(t *testing.T, cfg *Config) *kubernetesReceiver { diff --git a/receiver/k8sclusterreceiver/generated_package_test.go b/receiver/k8sclusterreceiver/generated_package_test.go index 35feefb66e47..c12c6c8e44c9 100644 --- a/receiver/k8sclusterreceiver/generated_package_test.go +++ b/receiver/k8sclusterreceiver/generated_package_test.go @@ -3,11 +3,10 @@ package k8sclusterreceiver import ( - "os" + "go.uber.org/goleak" "testing" ) func TestMain(m *testing.M) { - // skipping goleak test as per metadata.yml configuration - os.Exit(m.Run()) + goleak.VerifyTestMain(m) } diff --git a/receiver/k8sclusterreceiver/metadata.yaml b/receiver/k8sclusterreceiver/metadata.yaml index 677ceb29a544..246f99e3565a 100644 --- a/receiver/k8sclusterreceiver/metadata.yaml +++ b/receiver/k8sclusterreceiver/metadata.yaml @@ -519,5 +519,3 @@ metrics: tests: config: skip_lifecycle: true - goleak: - skip: true