diff --git a/test/e2e/framework/pod/utils.go b/test/e2e/framework/pod/utils.go index a5b9991f3ac..fb034e4b316 100644 --- a/test/e2e/framework/pod/utils.go +++ b/test/e2e/framework/pod/utils.go @@ -37,17 +37,9 @@ func NodeOSDistroIs(distro string) bool { } // GenerateScriptCmd generates the corresponding command lines to execute a command. -// 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 { - commands = []string{"powershell", "/c", command} - } + commands = []string{"/bin/sh", "-c", command} return commands } diff --git a/test/e2e/framework/volume/fixtures.go b/test/e2e/framework/volume/fixtures.go index 7c9842eec83..f13a5cb2fe9 100644 --- a/test/e2e/framework/volume/fixtures.go +++ b/test/e2e/framework/volume/fixtures.go @@ -368,11 +368,7 @@ func runVolumeTesterPod(client clientset.Interface, timeouts *framework.TimeoutC var gracePeriod int64 = 1 var command string - if !framework.NodeOSDistroIs("windows") { - command = "while true ; do sleep 2; done " - } else { - command = "while(1) {sleep 2}" - } + command = "while true ; do sleep 2; done " seLinuxOptions := &v1.SELinuxOptions{Level: "s0:c0,c1"} clientPod := &v1.Pod{ TypeMeta: metav1.TypeMeta{ @@ -572,47 +568,30 @@ func InjectContent(f *framework.Framework, config TestConfig, fsGroup *int64, fs // generateWriteCmd is used by generateWriteBlockCmd and generateWriteFileCmd func generateWriteCmd(content, path string) []string { var commands []string - if !framework.NodeOSDistroIs("windows") { - commands = []string{"/bin/sh", "-c", "echo '" + content + "' > " + path} - } else { - commands = []string{"powershell", "/c", "echo '" + content + "' > " + path} - } + commands = []string{"/bin/sh", "-c", "echo '" + content + "' > " + path} return commands } // generateReadBlockCmd generates the corresponding command lines to read from a block device with the given file path. -// Depending on the Node OS is Windows or linux, the command will use powershell or /bin/sh func generateReadBlockCmd(fullPath string, numberOfCharacters int) []string { var commands []string - if !framework.NodeOSDistroIs("windows") { - commands = []string{"head", "-c", strconv.Itoa(numberOfCharacters), fullPath} - } else { - // TODO: is there a way on windows to get the first X bytes from a device? - commands = []string{"powershell", "/c", "type " + fullPath} - } + commands = []string{"head", "-c", strconv.Itoa(numberOfCharacters), fullPath} return commands } // generateWriteBlockCmd generates the corresponding command lines to write to a block device the given content. -// Depending on the Node OS is Windows or linux, the command will use powershell or /bin/sh func generateWriteBlockCmd(content, fullPath string) []string { return generateWriteCmd(content, fullPath) } // GenerateReadFileCmd generates the corresponding command lines to read from a file with the given file path. -// Depending on the Node OS is Windows or linux, the command will use powershell or /bin/sh func GenerateReadFileCmd(fullPath string) []string { var commands []string - if !framework.NodeOSDistroIs("windows") { - commands = []string{"cat", fullPath} - } else { - commands = []string{"powershell", "/c", "type " + fullPath} - } + commands = []string{"cat", fullPath} return commands } // generateWriteFileCmd generates the corresponding command lines to write a file with the given content and file path. -// Depending on the Node OS is Windows or linux, the command will use powershell or /bin/sh func generateWriteFileCmd(content, fullPath string) []string { return generateWriteCmd(content, fullPath) } diff --git a/test/e2e/storage/testsuites/multivolume.go b/test/e2e/storage/testsuites/multivolume.go index e3ab2793b3d..7e3e8dea28e 100644 --- a/test/e2e/storage/testsuites/multivolume.go +++ b/test/e2e/storage/testsuites/multivolume.go @@ -132,7 +132,7 @@ func (t *multiVolumeTestSuite) DefineTests(driver storageframework.TestDriver, p // [ node1 ] ==> [ node1 ] // / \ <- same volume mode / \ // [volume1] [volume2] [volume1] [volume2] - ginkgo.It("should access to two volumes with the same volume mode and retain data across pod recreation on the same node [LinuxOnly]", func() { + ginkgo.It("should access to two volumes with the same volume mode and retain data across pod recreation on the same node", func() { // Currently, multiple volumes are not generally available for pre-provisoined volume, // because containerized storage servers, such as iSCSI and rbd, are just returning // a static volume inside container, not actually creating a new volume per request. @@ -162,7 +162,7 @@ func (t *multiVolumeTestSuite) DefineTests(driver storageframework.TestDriver, p // [ node1 ] ==> [ node2 ] // / \ <- same volume mode / \ // [volume1] [volume2] [volume1] [volume2] - ginkgo.It("should access to two volumes with the same volume mode and retain data across pod recreation on different node [LinuxOnly]", func() { + ginkgo.It("should access to two volumes with the same volume mode and retain data across pod recreation on different node", func() { // Currently, multiple volumes are not generally available for pre-provisoined volume, // because containerized storage servers, such as iSCSI and rbd, are just returning // a static volume inside container, not actually creating a new volume per request. @@ -203,7 +203,7 @@ func (t *multiVolumeTestSuite) DefineTests(driver storageframework.TestDriver, p // [ node1 ] ==> [ node1 ] // / \ <- different volume mode / \ // [volume1] [volume2] [volume1] [volume2] - ginkgo.It("should access to two volumes with different volume mode and retain data across pod recreation on the same node [LinuxOnly]", func() { + ginkgo.It("should access to two volumes with different volume mode and retain data across pod recreation on the same node", func() { if pattern.VolMode == v1.PersistentVolumeFilesystem { e2eskipper.Skipf("Filesystem volume case should be covered by block volume case -- skipping") } @@ -242,7 +242,7 @@ func (t *multiVolumeTestSuite) DefineTests(driver storageframework.TestDriver, p // [ node1 ] ==> [ node2 ] // / \ <- different volume mode / \ // [volume1] [volume2] [volume1] [volume2] - ginkgo.It("should access to two volumes with different volume mode and retain data across pod recreation on different node [LinuxOnly]", func() { + ginkgo.It("should access to two volumes with different volume mode and retain data across pod recreation on different node", func() { if pattern.VolMode == v1.PersistentVolumeFilesystem { e2eskipper.Skipf("Filesystem volume case should be covered by block volume case -- skipping") } @@ -292,7 +292,7 @@ func (t *multiVolumeTestSuite) DefineTests(driver storageframework.TestDriver, p // [ node1 ] // \ / <- same volume mode // [volume1] - ginkgo.It("should concurrently access the single volume from pods on the same node [LinuxOnly]", func() { + ginkgo.It("should concurrently access the single volume from pods on the same node", func() { init() defer cleanup() diff --git a/test/e2e/storage/testsuites/provisioning.go b/test/e2e/storage/testsuites/provisioning.go index cc98a412eba..08c7db678fb 100644 --- a/test/e2e/storage/testsuites/provisioning.go +++ b/test/e2e/storage/testsuites/provisioning.go @@ -551,7 +551,8 @@ func PVWriteReadSingleNodeCheck(client clientset.Interface, timeouts *framework. command += " || (mount | grep 'on /mnt/test'; false)" if framework.NodeOSDistroIs("windows") { - command = "select-string 'hello world' /mnt/test/data" + // agnhost doesn't support mount + command = "grep 'hello world' /mnt/test/data" } RunInPodWithVolume(client, timeouts, claim.Namespace, claim.Name, "pvc-volume-tester-reader", command, e2epod.NodeSelection{Name: actualNodeName}) @@ -596,9 +597,6 @@ func PVMultiNodeCheck(client clientset.Interface, timeouts *framework.TimeoutCon e2epod.SetAntiAffinity(&secondNode, actualNodeName) ginkgo.By(fmt.Sprintf("checking the created volume is readable and retains data on another node %+v", secondNode)) command = "grep 'hello world' /mnt/test/data" - if framework.NodeOSDistroIs("windows") { - command = "select-string 'hello world' /mnt/test/data" - } pod = StartInPodWithVolume(client, claim.Namespace, claim.Name, "pvc-reader-node2", command, secondNode) framework.ExpectNoError(e2epod.WaitForPodSuccessInNamespaceTimeout(client, pod.Name, pod.Namespace, timeouts.PodStartSlow)) runningPod, err = client.CoreV1().Pods(pod.Namespace).Get(context.TODO(), pod.Name, metav1.GetOptions{}) diff --git a/test/e2e/storage/testsuites/subpath.go b/test/e2e/storage/testsuites/subpath.go index 99394d78a48..4f6b10faddd 100644 --- a/test/e2e/storage/testsuites/subpath.go +++ b/test/e2e/storage/testsuites/subpath.go @@ -323,11 +323,7 @@ func (s *subPathTestSuite) DefineTests(driver storageframework.TestDriver, patte // Create the directory var command string - if framework.NodeOSDistroIs("windows") { - command = fmt.Sprintf("mkdir -p %v; New-Item -itemtype File -path %v", l.subPathDir, probeFilePath) - } else { - command = fmt.Sprintf("mkdir -p %v; touch %v", l.subPathDir, probeFilePath) - } + command = fmt.Sprintf("mkdir -p %v; touch %v", l.subPathDir, probeFilePath) setInitCommand(l.pod, command) testPodContainerRestart(f, l.pod) })