From 5e5a3ce85a8d2ec6f23587ceecaf9c38dfe66382 Mon Sep 17 00:00:00 2001 From: Jing Xu Date: Fri, 7 May 2021 10:53:40 -0700 Subject: [PATCH] Fix multivolume access tests for Windows Fix issue for multivolume access tests Change-Id: I7e00d8bfe9682540b60b5998f78f2a48550934af --- test/e2e/framework/pod/create.go | 6 +++--- test/e2e/framework/pod/utils.go | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/e2e/framework/pod/create.go b/test/e2e/framework/pod/create.go index 5266a77a455..32d7b0bb11b 100644 --- a/test/e2e/framework/pod/create.go +++ b/test/e2e/framework/pod/create.go @@ -19,7 +19,6 @@ package pod import ( "context" "fmt" - "runtime" "time" v1 "k8s.io/api/core/v1" @@ -167,11 +166,12 @@ func MakeSecPod(podConfig *Config) (*v1.Pod, error) { if podConfig.NS == "" { return nil, fmt.Errorf("Cannot create pod with empty namespace") } - if len(podConfig.Command) == 0 { + if len(podConfig.Command) == 0 && !NodeOSDistroIs("windows") { podConfig.Command = "trap exit TERM; while true; do sleep 1; done" } + podName := "pod-" + string(uuid.NewUUID()) - if podConfig.FsGroup == nil && runtime.GOOS != "windows" { + if podConfig.FsGroup == nil && !NodeOSDistroIs("windows") { podConfig.FsGroup = func(i int64) *int64 { return &i }(1000) diff --git a/test/e2e/framework/pod/utils.go b/test/e2e/framework/pod/utils.go index 865c93b9053..a5b9991f3ac 100644 --- a/test/e2e/framework/pod/utils.go +++ b/test/e2e/framework/pod/utils.go @@ -40,6 +40,9 @@ func NodeOSDistroIs(distro string) bool { // Depending on the Node OS is Windows or linux, the command will use powershell or /bin/sh func GenerateScriptCmd(command string) []string { var commands []string + if command == "" { + return commands + } if !NodeOSDistroIs("windows") { commands = []string{"/bin/sh", "-c", command} } else {