From 79e3f8f9760201a5f57555560ba82e299d203dc7 Mon Sep 17 00:00:00 2001 From: Ernest Wong Date: Thu, 2 Apr 2020 15:23:54 -0400 Subject: [PATCH] test: deflake deployment test case --- test/e2e/dynamic_provisioning_test.go | 6 +++--- .../dynamically_provisioned_delete_pod_tester.go | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test/e2e/dynamic_provisioning_test.go b/test/e2e/dynamic_provisioning_test.go index 8b46cbf1a5..e32a4704d5 100644 --- a/test/e2e/dynamic_provisioning_test.go +++ b/test/e2e/dynamic_provisioning_test.go @@ -189,10 +189,10 @@ var _ = ginkgo.Describe("Dynamic Provisioning", func() { } podCheckCmd := []string{"cat", "/mnt/test-1/data"} - expectedString := "hello world\nhello world\n" + expectedString := "hello world\n" if isWindowsCluster { podCheckCmd = []string{"powershell.exe", "cat", "C:\\mnt\\test-1\\data.txt"} - expectedString = "hello world\r\nhello world\r\n" + expectedString = "hello world\r\n" } test := testsuites.DynamicallyProvisionedDeletePodTest{ CSIDriver: testDriver, @@ -438,7 +438,7 @@ var _ = ginkgo.Describe("Dynamic Provisioning", func() { Pod: pod, PodCheck: &testsuites.PodExecCheck{ Cmd: []string{"cat", "/mnt/test-1/data"}, - ExpectedString: "hello world\nhello world\n", // pod will be restarted so expect to see 2 instances of string + ExpectedString: "hello world\n", }, StorageClassParameters: map[string]string{"skuName": "Standard_LRS", "fsType": "xfs"}, } diff --git a/test/e2e/testsuites/dynamically_provisioned_delete_pod_tester.go b/test/e2e/testsuites/dynamically_provisioned_delete_pod_tester.go index 6be73c0ec9..ac0f95147d 100644 --- a/test/e2e/testsuites/dynamically_provisioned_delete_pod_tester.go +++ b/test/e2e/testsuites/dynamically_provisioned_delete_pod_tester.go @@ -52,6 +52,11 @@ func (t *DynamicallyProvisionedDeletePodTest) Run(client clientset.Interface, na ginkgo.By("checking that the pod is running") tDeployment.WaitForPodReady() + if t.PodCheck != nil { + ginkgo.By("checking pod exec") + tDeployment.Exec(t.PodCheck.Cmd, t.PodCheck.ExpectedString) + } + ginkgo.By("deleting the pod for deployment") tDeployment.DeletePodAndWait() @@ -60,6 +65,7 @@ func (t *DynamicallyProvisionedDeletePodTest) Run(client clientset.Interface, na if t.PodCheck != nil { ginkgo.By("checking pod exec") - tDeployment.Exec(t.PodCheck.Cmd, t.PodCheck.ExpectedString) + // pod will be restarted so expect to see 2 instances of string + tDeployment.Exec(t.PodCheck.Cmd, t.PodCheck.ExpectedString+t.PodCheck.ExpectedString) } }