mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Use ioutil.TempDir for temporary dir creating
This commit is contained in:
		@@ -20,6 +20,7 @@ import (
 | 
				
			|||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"io/ioutil"
 | 
						"io/ioutil"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
 | 
						"path/filepath"
 | 
				
			||||||
	"reflect"
 | 
						"reflect"
 | 
				
			||||||
	"runtime"
 | 
						"runtime"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
@@ -415,8 +416,12 @@ func TestProcessHostnameOverrideFlag(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func TestConfigChange(t *testing.T) {
 | 
					func TestConfigChange(t *testing.T) {
 | 
				
			||||||
	setUp := func() (*os.File, string, error) {
 | 
						setUp := func() (*os.File, string, error) {
 | 
				
			||||||
		tempDir := os.TempDir()
 | 
							tempDir, err := ioutil.TempDir("", "kubeproxy-config-change")
 | 
				
			||||||
		file, err := ioutil.TempFile(tempDir, "kube-proxy-config-")
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return nil, "", fmt.Errorf("Unable to create temporary directory: %v", err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							fullPath := filepath.Join(tempDir, "kube-proxy-config")
 | 
				
			||||||
 | 
							file, err := os.Create(fullPath)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, "", fmt.Errorf("unexpected error when creating temp file: %v", err)
 | 
								return nil, "", fmt.Errorf("unexpected error when creating temp file: %v", err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user