Skip to content

Commit

Permalink
Fix the TestFlowAggregator e2e test when failing
Browse files Browse the repository at this point in the history
Timeout values are quite high when the tests are failing
intermittently on dual stack clusters.
Fix that by reducing poll timeout when checking for logs on
ipfix-collector pod.
  • Loading branch information
srikartati committed Apr 7, 2021
1 parent 9a9804a commit 92ac8ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions test/e2e/flowaggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ AntreaProxy enabled (Inter-Node): Flow record from destination Node is ignored,
const (
ingressNetworkPolicyName = "test-flow-aggregator-networkpolicy-ingress"
egressNetworkPolicyName = "test-flow-aggregator-networkpolicy-egress"
collectorCheckTimeout = 10 * time.Second
// Single iperf run results in two connections with separate ports (control connection and actual data connection).
// As 5s is export interval and iperf traffic runs for 10s, we expect about 4 records exporting to the flow aggregator.
// Since flow aggregator will aggregate records based on 5-tuple connection key, we expect 2 records.
Expand Down Expand Up @@ -216,8 +215,8 @@ func checkRecordsForFlows(t *testing.T, data *TestData, srcIP string, dstIP stri

// Polling to make sure all the data records corresponding to the iperf flow
// are received.
err = wait.Poll(250*time.Millisecond, collectorCheckTimeout, func() (bool, error) {
rc, collectorOutput, _, err := provider.RunCommandOnNode(controlPlaneNodeName(), fmt.Sprintf("kubectl logs --since=%v ipfix-collector -n antrea-test", time.Since(timeStart).String()))
err = wait.PollImmediate(500*time.Millisecond, flowAggregatorExportInterval, func() (bool, error) {
rc, collectorOutput, _, err := provider.RunCommandOnNode(controlPlaneNodeName(), fmt.Sprintf("kubectl logs --since=%v --pod-running-timeout=%v ipfix-collector -n antrea-test", time.Since(timeStart).String(), flowAggregatorExportInterval.String()))
if err != nil || rc != 0 {
return false, err
}
Expand Down
7 changes: 4 additions & 3 deletions test/e2e/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ import (
)

const (
defaultTimeout = 90 * time.Second
defaultInterval = 1 * time.Second
defaultTimeout = 90 * time.Second
defaultInterval = 1 * time.Second
flowAggregatorExportInterval = 5 * time.Second

// antreaNamespace is the K8s Namespace in which all Antrea resources are running.
antreaNamespace string = "kube-system"
Expand Down Expand Up @@ -587,7 +588,7 @@ func (data *TestData) mutateFlowAggregatorConfigMap(ipfixCollector string) error
}
flowAggregatorConf, _ := configMap.Data[flowAggregatorConfName]
flowAggregatorConf = strings.Replace(flowAggregatorConf, "#externalFlowCollectorAddr: \"\"", fmt.Sprintf("externalFlowCollectorAddr: \"%s\"", ipfixCollector), 1)
flowAggregatorConf = strings.Replace(flowAggregatorConf, "#flowExportInterval: 60s", "flowExportInterval: 5s", 1)
flowAggregatorConf = strings.Replace(flowAggregatorConf, "#flowExportInterval: 60s", fmt.Sprintf("flowExportInterval: \"%s\"", flowAggregatorExportInterval.String()), 1)
if testOptions.providerName == "kind" {
// In Kind cluster, there are issues with DNS name resolution on worker nodes.
// We will skip TLS testing for Kind cluster because the server certificate is generated with Flow aggregator's DNS name
Expand Down

0 comments on commit 92ac8ba

Please sign in to comment.