From 2ac6d4d1339c733a572eb2e741f515c93f6f95b1 Mon Sep 17 00:00:00 2001 From: Mauricio Poppe Date: Thu, 18 Mar 2021 06:42:43 +0000 Subject: [PATCH 1/3] fix Pod Disks schedule pods each with a PD test in windows --- test/e2e/framework/kubectl/kubectl_utils.go | 4 ++++ test/e2e/storage/pd.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/e2e/framework/kubectl/kubectl_utils.go b/test/e2e/framework/kubectl/kubectl_utils.go index d6765d23b47..264505f6344 100644 --- a/test/e2e/framework/kubectl/kubectl_utils.go +++ b/test/e2e/framework/kubectl/kubectl_utils.go @@ -142,6 +142,10 @@ func (tk *TestKubeconfig) WriteFileViaContainer(podName, containerName string, p } } command := fmt.Sprintf("echo '%s' > '%s'; sync", contents, path) + // TODO: replace with `framework.NodeOSDistroIs` when #81245 is complete + if e2epod.NodeOSDistroIs("windows") { + command = fmt.Sprintf("echo '%s' > '%s'; sleep 1", contents, path) + } stdout, stderr, err := tk.kubectlExecWithRetry(tk.Namespace, podName, containerName, "--", "/bin/sh", "-c", command) if err != nil { e2elog.Logf("error running kubectl exec to write file: %v\nstdout=%v\nstderr=%v)", err, string(stdout), string(stderr)) diff --git a/test/e2e/storage/pd.go b/test/e2e/storage/pd.go index b3dc2ffd015..63118d06eb9 100644 --- a/test/e2e/storage/pd.go +++ b/test/e2e/storage/pd.go @@ -596,7 +596,7 @@ func testPDPod(diskNames []string, targetNode types.NodeName, readOnly bool, num if numContainers > 1 { containers[i].Name = fmt.Sprintf("mycontainer%v", i+1) } - containers[i].Image = imageutils.GetE2EImage(imageutils.BusyBox) + containers[i].Image = e2epod.GetTestImage(imageutils.BusyBox) containers[i].Command = []string{"sleep", "6000"} containers[i].VolumeMounts = make([]v1.VolumeMount, len(diskNames)) for k := range diskNames { @@ -636,7 +636,7 @@ func testPDPod(diskNames []string, targetNode types.NodeName, readOnly bool, num pod.Spec.Volumes[k].VolumeSource = v1.VolumeSource{ GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{ PDName: diskName, - FSType: "ext4", + FSType: e2epv.GetDefaultFSType(), ReadOnly: readOnly, }, } From 7b0b47c132464d385c74e91868b7fe888bfd6efd Mon Sep 17 00:00:00 2001 From: Mauricio Poppe Date: Tue, 30 Mar 2021 18:37:58 +0000 Subject: [PATCH 2/3] remove sleep 1 and check later if the test is flaky --- test/e2e/framework/kubectl/kubectl_utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/framework/kubectl/kubectl_utils.go b/test/e2e/framework/kubectl/kubectl_utils.go index 264505f6344..f435453a0c8 100644 --- a/test/e2e/framework/kubectl/kubectl_utils.go +++ b/test/e2e/framework/kubectl/kubectl_utils.go @@ -144,7 +144,7 @@ func (tk *TestKubeconfig) WriteFileViaContainer(podName, containerName string, p command := fmt.Sprintf("echo '%s' > '%s'; sync", contents, path) // TODO: replace with `framework.NodeOSDistroIs` when #81245 is complete if e2epod.NodeOSDistroIs("windows") { - command = fmt.Sprintf("echo '%s' > '%s'; sleep 1", contents, path) + command = fmt.Sprintf("echo '%s' > '%s';", contents, path) } stdout, stderr, err := tk.kubectlExecWithRetry(tk.Namespace, podName, containerName, "--", "/bin/sh", "-c", command) if err != nil { From eaf2954ad8711fabe4374c8273e960b9d8972072 Mon Sep 17 00:00:00 2001 From: Mauricio Poppe Date: Fri, 16 Apr 2021 00:01:18 +0000 Subject: [PATCH 3/3] Add a TODO to install sync in agnhost --- test/e2e/framework/kubectl/kubectl_utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/framework/kubectl/kubectl_utils.go b/test/e2e/framework/kubectl/kubectl_utils.go index f435453a0c8..e95d4b5f148 100644 --- a/test/e2e/framework/kubectl/kubectl_utils.go +++ b/test/e2e/framework/kubectl/kubectl_utils.go @@ -142,7 +142,7 @@ func (tk *TestKubeconfig) WriteFileViaContainer(podName, containerName string, p } } command := fmt.Sprintf("echo '%s' > '%s'; sync", contents, path) - // TODO: replace with `framework.NodeOSDistroIs` when #81245 is complete + // TODO(mauriciopoppe): remove this statement once we add `sync` to the test image, ref #101172 if e2epod.NodeOSDistroIs("windows") { command = fmt.Sprintf("echo '%s' > '%s';", contents, path) }