mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
run dummy command return status 0
This commit is contained in:
parent
99d73dfae5
commit
b84ba39a0f
@ -30,7 +30,6 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
utilexec "k8s.io/utils/exec"
|
||||
testexec "k8s.io/utils/exec/testing"
|
||||
@ -612,14 +611,11 @@ func TestDetectSafeNotMountedBehavior(t *testing.T) {
|
||||
func TestCheckUmountError(t *testing.T) {
|
||||
target := "/test/path"
|
||||
withSafeNotMountedBehavior := true
|
||||
command := exec.Command("uname", "-r") // dummy command return status 0
|
||||
|
||||
pState := &os.ProcessState{}
|
||||
var ref_pState reflect.Value = reflect.ValueOf(pState).Elem()
|
||||
var ref_status reflect.Value = ref_pState.FieldByName("status")
|
||||
status := (*uint32)(unsafe.Pointer(ref_status.UnsafeAddr()))
|
||||
*status = 0
|
||||
|
||||
command := &exec.Cmd{ProcessState: pState} // dummy command return status 0
|
||||
if err := command.Run(); err != nil {
|
||||
t.Errorf("Faild to exec dummy command. err: %s", err)
|
||||
}
|
||||
|
||||
testcases := []struct {
|
||||
output []byte
|
||||
|
Loading…
Reference in New Issue
Block a user