Adding lock files for kubeconfig updating

This commit is contained in:
Kris
2016-06-24 11:08:23 -07:00
parent 178bcd1c11
commit 88e2a31978
2 changed files with 42 additions and 0 deletions

View File

@@ -376,6 +376,22 @@ func TestMigratingFileSourceMissingSkip(t *testing.T) {
}
}
func TestFileLocking(t *testing.T) {
f, _ := ioutil.TempFile("", "")
defer os.Remove(f.Name())
err := lockFile(f.Name())
if err != nil {
t.Errorf("unexpected error while locking file: %v", err)
}
defer unlockFile(f.Name())
err = lockFile(f.Name())
if err == nil {
t.Error("expected error while locking file.")
}
}
func Example_noMergingOnExplicitPaths() {
commandLineFile, _ := ioutil.TempFile("", "")
defer os.Remove(commandLineFile.Name())