Change:
}, } for _, tc := range cases { <del> testNamespace := "test_projected_namespace" tc.configMap.ObjectMeta = metav1.ObjectMeta{ Namespace: testNamespace, Name:      tc.name, } </del> <ins> t.Run(tc.name, func(t *testing.T) { testNamespace := "test_projected_namespace" tc.configMap.ObjectMeta = metav1.ObjectMeta{ Namespace: testNamespace, Name:      tc.name, } </ins> <del> source := makeProjection(tc.name, tc.mode, "configMap") source.Sources[0].ConfigMap.Items = tc.mappings source.Sources[0].ConfigMap.Optional = &tc.optional testPodUID := types.UID("test_pod_uid") pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} client := fake.NewSimpleClientset(tc.configMap) _, host := newTestHost(t, client) var myVolumeMounter = projectedVolumeMounter{ projectedVolume: &projectedVolume{ sources: source.Sources, podUID:  pod.UID, plugin: &projectedPlugin{ host:         host, getConfigMap: host.GetConfigMapFunc(), </del> <ins> source := makeProjection(tc.name, tc.mode, "configMap") source.Sources[0].ConfigMap.Items = tc.mappings source.Sources[0].ConfigMap.Optional = &tc.optional testPodUID := types.UID("test_pod_uid") pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: testNamespace, UID: testPodUID}} client := fake.NewSimpleClientset(tc.configMap) tempDir, host := newTestHost(t, client) defer os.RemoveAll(tempDir) var myVolumeMounter = projectedVolumeMounter{ projectedVolume: &projectedVolume{ sources: source.Sources, podUID:  pod.UID, plugin: &projectedPlugin{ host:         host, getConfigMap: host.GetConfigMapFunc(), }, </ins> }, <del> }, source: *source, pod:    pod, } </del> <ins> source: *source, pod:    pod, } </ins> <del> actualPayload, err := myVolumeMounter.collectData() if err != nil && tc.success { t.Errorf("%v: unexpected failure making payload: %v", tc.name, err) continue } if err == nil && !tc.success { t.Errorf("%v: unexpected success making payload", tc.name) continue } if !tc.success { continue } if e, a := tc.payload, actualPayload; !reflect.DeepEqual(e, a) { t.Errorf("%v: expected and actual payload do not match", tc.name) } </del> <ins> actualPayload, err := myVolumeMounter.collectData() if err != nil && tc.success { t.Errorf("%v: unexpected failure making payload: %v", tc.name, err) return } if err == nil && !tc.success { t.Errorf("%v: unexpected success making payload", tc.name) return } if !tc.success { return } if e, a := tc.payload, actualPayload; !reflect.DeepEqual(e, a) { t.Errorf("%v: expected and actual payload do not match", tc.name) } }) </ins> } }

Discussion:
<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks! If the matter is security related, please disclose it privately via --What happened: I run the unit tests for , but I found it would not clean the tempdir it created. ! What you expected to happen: automatically clean up when finishing unit tests. How to reproduce it (as minimally and precisely as possible): go test $ Anything else we need to know?: Environment: k8s 1.15 Kubernetes version (use ): Cloud provider or hardware configuration: OS (e.g: ): Kernel (e.g. ): Install tools: Network plugin and version (if this is a network-related bug): Others:
/sig storage /sig testing
/assign Assign the issue to you since you have fired a pull request.