From b84ba39a0f13e77fcb41fa1208801d6ac06a1c33 Mon Sep 17 00:00:00 2001 From: mochizuki875 Date: Wed, 22 Feb 2023 16:55:15 +0900 Subject: [PATCH] run dummy command return status 0 --- staging/src/k8s.io/mount-utils/mount_linux_test.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/staging/src/k8s.io/mount-utils/mount_linux_test.go b/staging/src/k8s.io/mount-utils/mount_linux_test.go index c34aa0be539..61823abb9f0 100644 --- a/staging/src/k8s.io/mount-utils/mount_linux_test.go +++ b/staging/src/k8s.io/mount-utils/mount_linux_test.go @@ -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