Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian committed Aug 14, 2024
1 parent d36d87f commit 23f36dc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/e2e/iptables-vpc-nat-gw/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1069,20 +1069,19 @@ func createNatGwAndSetQosCases(f *framework.Framework,
}

func validRateLimit(text string, limit int) bool {
maxValue := float64(limit) * 1024 * 1024 * 1.2
minValue := float64(limit) * 1024 * 1024 * 0.8
lines := strings.Split(text, "\n")
for _, line := range lines {
if line == "" {
continue
}
fields := strings.Split(line, ",")
lastField := fields[len(fields)-1]
number, err := strconv.Atoi(lastField)
number, err := strconv.Atoi(fields[len(fields)-1])
if err != nil {
continue
}
max := float64(limit) * 1024 * 1024 * 1.2
min := float64(limit) * 1024 * 1024 * 0.8
if min <= float64(number) && float64(number) <= max {
if v := float64(number); v >= minValue && v <= maxValue {
return true
}
}
Expand Down

0 comments on commit 23f36dc

Please sign in to comment.