From ecbf2dddc2ed4ed342047fdf9e8759c94f57e652 Mon Sep 17 00:00:00 2001 From: Yongming Ding Date: Mon, 18 Jul 2022 11:54:29 -0700 Subject: [PATCH] Address comments Signed-off-by: Yongming Ding --- test/e2e/flowvisibility_test.go | 10 ---------- test/e2e/policyrecommendation_test.go | 13 +++---------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/test/e2e/flowvisibility_test.go b/test/e2e/flowvisibility_test.go index 4b4a06fc..2073f251 100644 --- a/test/e2e/flowvisibility_test.go +++ b/test/e2e/flowvisibility_test.go @@ -163,7 +163,6 @@ func testHelper(t *testing.T, data *TestData, podAIPs, podBIPs, podCIPs, podDIPs if err != nil { t.Fatalf("Error when creating perftest Services: %v", err) } - defer deletePerftestServices(t, data) // Wait for the Service to be realized. time.Sleep(3 * time.Second) @@ -1062,15 +1061,6 @@ func createPerftestServices(data *TestData, isIPv6 bool) (svcB *corev1.Service, return svcB, svcC, nil } -func deletePerftestServices(t *testing.T, data *TestData) { - for _, serviceName := range []string{"perftest-b", "perftest-c"} { - err := data.deleteService(testNamespace, serviceName) - if err != nil { - t.Logf("Error when deleting %s Service: %v", serviceName, err) - } - } -} - // getBandwidthAndPorts parses iperf commands output and returns bandwidth, // source port and destination port. Bandwidth is returned as a slice containing // two strings (bandwidth value and bandwidth unit). diff --git a/test/e2e/policyrecommendation_test.go b/test/e2e/policyrecommendation_test.go index 8f2dda58..4c604cf0 100644 --- a/test/e2e/policyrecommendation_test.go +++ b/test/e2e/policyrecommendation_test.go @@ -71,7 +71,6 @@ func TestPolicyRecommendation(t *testing.T) { if err != nil { t.Fatalf("Error when creating perftest-b Service: %v", err) } - defer deleteTestService(t, data) // Wait for the Service to be realized. time.Sleep(3 * time.Second) // In dual stack cluster, Service IP can be assigned as different IP family from specified. @@ -93,9 +92,10 @@ func TestPolicyRecommendation(t *testing.T) { if v4Enabled { srcIP := podAIPs.ipv4.String() + dstIP := podBIPs.ipv4.String() testFlowPodToPod := testFlow{ srcIP: srcIP, - dstIP: podBIPs.ipv4.String(), + dstIP: dstIP, srcPodName: "perftest-a", dstPodName: "perftest-b", } @@ -210,7 +210,7 @@ func testPolicyRecommendationFailed(t *testing.T, data *TestData) { }) require.NoError(t, err) assert := assert.New(t) - assert.Containsf(stdout, "Error message: driver", "stdout: %s", stdout) + assert.Truef(strings.Contains(stdout, "Error message: driver pod not found") || strings.Contains(stdout, "Error message: driver container failed"), "stdout: %s", stdout) } // Example output: @@ -394,10 +394,3 @@ func createTestService(data *TestData, isIPv6 bool) (svcB *corev1.Service, err e return svcB, nil } - -func deleteTestService(t *testing.T, data *TestData) { - err := data.deleteService(testNamespace, "perftest-b") - if err != nil { - t.Logf("Error when deleting perftest-b Service: %v", err) - } -}