mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-02 15:45:09 +00:00
fix fd leaks and failed file removing for pkg client-go
Kubernetes-commit: 73aeed8766c2c42a6cb4fc8632b1b974f4508dde
This commit is contained in:
committed by
Kubernetes Publisher
parent
a9b2f9e9eb
commit
84dc0417b2
@@ -23,6 +23,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
utiltesting "k8s.io/client-go/util/testing"
|
||||
|
||||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
||||
)
|
||||
@@ -296,7 +298,7 @@ func TestValidateCleanClusterInfo(t *testing.T) {
|
||||
|
||||
func TestValidateCleanWithCAClusterInfo(t *testing.T) {
|
||||
tempFile, _ := os.CreateTemp("", "")
|
||||
defer os.Remove(tempFile.Name())
|
||||
defer utiltesting.CloseAndRemove(t, tempFile)
|
||||
|
||||
config := clientcmdapi.NewConfig()
|
||||
config.Clusters["clean"] = &clientcmdapi.Cluster{
|
||||
@@ -339,7 +341,7 @@ func TestValidateCertFilesNotFoundAuthInfo(t *testing.T) {
|
||||
|
||||
func TestValidateCertDataOverridesFiles(t *testing.T) {
|
||||
tempFile, _ := os.CreateTemp("", "")
|
||||
defer os.Remove(tempFile.Name())
|
||||
defer utiltesting.CloseAndRemove(t, tempFile)
|
||||
|
||||
config := clientcmdapi.NewConfig()
|
||||
config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{
|
||||
@@ -359,7 +361,7 @@ func TestValidateCertDataOverridesFiles(t *testing.T) {
|
||||
|
||||
func TestValidateCleanCertFilesAuthInfo(t *testing.T) {
|
||||
tempFile, _ := os.CreateTemp("", "")
|
||||
defer os.Remove(tempFile.Name())
|
||||
defer utiltesting.CloseAndRemove(t, tempFile)
|
||||
|
||||
config := clientcmdapi.NewConfig()
|
||||
config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{
|
||||
|
Reference in New Issue
Block a user