From 9fcff922982e8fc2ee403507145ec8996f567422 Mon Sep 17 00:00:00 2001 From: Yongming Ding Date: Tue, 16 Mar 2021 16:16:55 -0700 Subject: [PATCH] Add IPv4/v6 dual stack support in Flow aggregator Fix the e2e test failure in dual stack cluster of flow aggregator. --- test/e2e/flowaggregator_test.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/e2e/flowaggregator_test.go b/test/e2e/flowaggregator_test.go index 1b93c7b4fff..71d90ae9342 100644 --- a/test/e2e/flowaggregator_test.go +++ b/test/e2e/flowaggregator_test.go @@ -102,7 +102,6 @@ const ( ) func TestFlowAggregator(t *testing.T) { - skipIfDualStackCluster(t) data, isIPv6, err := setupTestWithIPFIXCollector(t) if err != nil { t.Fatalf("Error when setting up test: %v", err) @@ -170,7 +169,12 @@ func TestFlowAggregator(t *testing.T) { if !isIPv6 { checkRecordsForFlows(t, data, podAIP.ipv4.String(), svcB.Spec.ClusterIP, isIPv6, true, true, false, false) } else { - checkRecordsForFlows(t, data, podAIP.ipv6.String(), svcB.Spec.ClusterIP, isIPv6, true, true, false, false) + // Perftest service may be assigned a IPv4 ClusterIP in dual stack cluster + if strings.Count(svcB.Spec.ClusterIP, ":") >= 2 { + checkRecordsForFlows(t, data, podAIP.ipv6.String(), svcB.Spec.ClusterIP, isIPv6, true, true, false, false) + } else { + checkRecordsForFlows(t, data, podAIP.ipv4.String(), svcB.Spec.ClusterIP, false, true, true, false, false) + } } }) @@ -180,7 +184,11 @@ func TestFlowAggregator(t *testing.T) { if !isIPv6 { checkRecordsForFlows(t, data, podAIP.ipv4.String(), svcC.Spec.ClusterIP, isIPv6, false, true, false, true) } else { - checkRecordsForFlows(t, data, podAIP.ipv6.String(), svcC.Spec.ClusterIP, isIPv6, false, true, false, true) + if strings.Count(svcC.Spec.ClusterIP, ":") >= 2 { + checkRecordsForFlows(t, data, podAIP.ipv6.String(), svcC.Spec.ClusterIP, isIPv6, false, true, false, true) + } else { + checkRecordsForFlows(t, data, podAIP.ipv4.String(), svcC.Spec.ClusterIP, false, false, true, false, true) + } } }) }