Skip to content

Commit

Permalink
redefine last record
Browse files Browse the repository at this point in the history
Signed-off-by: Yun-Tang Hsu <[email protected]>
  • Loading branch information
Yun-Tang Hsu committed Dec 7, 2023
1 parent e93ece2 commit e6d0c50
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/e2e/flowaggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ func checkRecordsForFlowsCollector(t *testing.T, data *TestData, srcIP, dstIP, s
flowEndReason := int64(getUint64FieldFromRecord(t, record, "flowEndReason"))
var recBandwidth float64
// flowEndReason == 3 means the end of flow detected
if exportTime >= flowStartTime+iperfTimeSec || flowEndReason == 3 {
if exportTime >= flowStartTime+iperfTimeSec && flowEndReason == 3 {
// Check average bandwidth on the last record.
octetTotalCount := getUint64FieldFromRecord(t, record, "octetTotalCount")
recBandwidth = float64(octetTotalCount) * 8 / float64(iperfTimeSec) / 1000000
Expand Down Expand Up @@ -1110,7 +1110,7 @@ func checkRecordsForFlowsClickHouse(t *testing.T, data *TestData, srcIP, dstIP,
exportTime := record.FlowEndSeconds.Unix()
var recBandwidth float64
// flowEndReason == 3 means the end of flow detected
if exportTime >= flowStartTime+iperfTimeSec || record.FlowEndReason == 3 {
if exportTime >= flowStartTime+iperfTimeSec && record.FlowEndReason == 3 {
octetTotalCount := record.OctetTotalCount
recBandwidth = float64(octetTotalCount) * 8 / float64(exportTime-flowStartTime) / 1000000
} else {
Expand Down Expand Up @@ -1424,7 +1424,7 @@ func getCollectorOutput(t *testing.T, srcIP, dstIP, srcPort string, isDstService
exportTime := int64(getUint64FieldFromRecord(t, record, "flowEndSeconds"))
flowEndReason := int64(getUint64FieldFromRecord(t, record, "flowEndReason"))
// flowEndReason == 3 means the end of flow detected
if exportTime >= flowStartTime+iperfTimeSec || flowEndReason == 3 {
if exportTime >= flowStartTime+iperfTimeSec && flowEndReason == 3 {
return true, nil
}
}
Expand Down Expand Up @@ -1488,7 +1488,7 @@ func getClickHouseOutput(t *testing.T, data *TestData, srcIP, dstIP, srcPort str
flowStartTime := record.FlowStartSeconds.Unix()
exportTime := record.FlowEndSeconds.Unix()
// flowEndReason == 3 means the end of flow detected
if exportTime >= flowStartTime+iperfTimeSec || record.FlowEndReason == 3 {
if exportTime >= flowStartTime+iperfTimeSec && record.FlowEndReason == 3 {
return true, nil
}
}
Expand Down

0 comments on commit e6d0c50

Please sign in to comment.