mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
Revert "add unit test for check unmounted behavior of Unmount"
This reverts commit bf77290bbf
.
Because the unit tests requires to run as root.
This commit is contained in:
parent
e7bd00b0b8
commit
673ea6af78
@ -705,28 +705,3 @@ func makeFakeCommandAction(stdout string, err error, cmdFn func()) testexec.Fake
|
|||||||
return testexec.InitFakeCmd(&c, cmd, args...)
|
return testexec.InitFakeCmd(&c, cmd, args...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNotMountedBehaviorOfUnmount(t *testing.T) {
|
|
||||||
target, err := ioutil.TempDir("", "kubelet-umount")
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("Cannot create temp dir: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
defer os.RemoveAll(target)
|
|
||||||
|
|
||||||
m := Mounter{withSafeNotMountedBehavior: true}
|
|
||||||
if err = m.Unmount(target); err != nil {
|
|
||||||
t.Errorf(`Expect complete Unmount(), but it dose not: %v`, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = tryUnmount(target, m.withSafeNotMountedBehavior, time.Minute); err != nil {
|
|
||||||
t.Errorf(`Expect complete tryUnmount(), but it does not: %v`, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// forceUmount exec "umount -f", so skip this case if user is not root.
|
|
||||||
if os.Getuid() == 0 {
|
|
||||||
if err = forceUmount(target, m.withSafeNotMountedBehavior); err != nil {
|
|
||||||
t.Errorf(`Expect complete forceUnmount(), but it does not: %v`, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user