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