fix when os.Remove should be os.RemoveAll
Signed-off-by: Jess Frazelle <acidburn@google.com>
This commit is contained in:
@@ -33,7 +33,7 @@ func TestWriteStaticPodManifests(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Couldn't create tmpdir")
|
t.Fatalf("Couldn't create tmpdir")
|
||||||
}
|
}
|
||||||
defer os.Remove(tmpdir)
|
defer os.RemoveAll(tmpdir)
|
||||||
|
|
||||||
// set up tmp GlobalEnvParams values for testing
|
// set up tmp GlobalEnvParams values for testing
|
||||||
oldEnv := kubeadmapi.GlobalEnvParams
|
oldEnv := kubeadmapi.GlobalEnvParams
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ func TestWriteKeysAndCert(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Couldn't create tmpdir")
|
t.Fatalf("Couldn't create tmpdir")
|
||||||
}
|
}
|
||||||
defer os.Remove(tmpdir)
|
defer os.RemoveAll(tmpdir)
|
||||||
|
|
||||||
caKey, err := rsa.GenerateKey(rand.Reader, 2048)
|
caKey, err := rsa.GenerateKey(rand.Reader, 2048)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ func TestWriteKubeconfigToDisk(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Couldn't create tmpdir")
|
t.Fatalf("Couldn't create tmpdir")
|
||||||
}
|
}
|
||||||
defer os.Remove(tmpdir)
|
defer os.RemoveAll(tmpdir)
|
||||||
|
|
||||||
// set up tmp GlobalEnvParams values for testing
|
// set up tmp GlobalEnvParams values for testing
|
||||||
oldEnv := kubeadmapi.GlobalEnvParams
|
oldEnv := kubeadmapi.GlobalEnvParams
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ func TestErrorReadingNonFile(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Couldn't create tmpdir")
|
t.Fatalf("Couldn't create tmpdir")
|
||||||
}
|
}
|
||||||
defer os.Remove(tmpdir)
|
defer os.RemoveAll(tmpdir)
|
||||||
|
|
||||||
loadingRules := ClientConfigLoadingRules{
|
loadingRules := ClientConfigLoadingRules{
|
||||||
ExplicitPath: tmpdir,
|
ExplicitPath: tmpdir,
|
||||||
@@ -224,14 +224,15 @@ func TestResolveRelativePaths(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configDir1, _ := ioutil.TempDir("", "")
|
configDir1, _ := ioutil.TempDir("", "")
|
||||||
|
defer os.RemoveAll(configDir1)
|
||||||
configFile1 := path.Join(configDir1, ".kubeconfig")
|
configFile1 := path.Join(configDir1, ".kubeconfig")
|
||||||
configDir1, _ = filepath.Abs(configDir1)
|
configDir1, _ = filepath.Abs(configDir1)
|
||||||
defer os.Remove(configFile1)
|
|
||||||
configDir2, _ := ioutil.TempDir("", "")
|
configDir2, _ := ioutil.TempDir("", "")
|
||||||
|
defer os.RemoveAll(configDir2)
|
||||||
configDir2, _ = ioutil.TempDir(configDir2, "")
|
configDir2, _ = ioutil.TempDir(configDir2, "")
|
||||||
configFile2 := path.Join(configDir2, ".kubeconfig")
|
configFile2 := path.Join(configDir2, ".kubeconfig")
|
||||||
configDir2, _ = filepath.Abs(configDir2)
|
configDir2, _ = filepath.Abs(configDir2)
|
||||||
defer os.Remove(configFile2)
|
|
||||||
|
|
||||||
WriteToFile(pathResolutionConfig1, configFile1)
|
WriteToFile(pathResolutionConfig1, configFile1)
|
||||||
WriteToFile(pathResolutionConfig2, configFile2)
|
WriteToFile(pathResolutionConfig2, configFile2)
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ func TestSoftRequirementsValidationSuccess(t *testing.T) {
|
|||||||
req := require.New(t)
|
req := require.New(t)
|
||||||
tempDir, err := ioutil.TempDir("", "")
|
tempDir, err := ioutil.TempDir("", "")
|
||||||
req.NoError(err)
|
req.NoError(err)
|
||||||
|
defer os.RemoveAll(tempDir)
|
||||||
req.NoError(ioutil.WriteFile(path.Join(tempDir, "cpu.cfs_period_us"), []byte("0"), os.ModePerm))
|
req.NoError(ioutil.WriteFile(path.Join(tempDir, "cpu.cfs_period_us"), []byte("0"), os.ModePerm))
|
||||||
req.NoError(ioutil.WriteFile(path.Join(tempDir, "cpu.cfs_quota_us"), []byte("0"), os.ModePerm))
|
req.NoError(ioutil.WriteFile(path.Join(tempDir, "cpu.cfs_quota_us"), []byte("0"), os.ModePerm))
|
||||||
mountInt := &fakeMountInterface{
|
mountInt := &fakeMountInterface{
|
||||||
|
|||||||
Reference in New Issue
Block a user