Skip to content

Commit

Permalink
Oops, i guess my unit test was flaky in #1068
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Ullian authored and aauren committed May 25, 2021
1 parent e49c255 commit c139c04
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/utils/ipset.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,13 @@ func buildIPSetRestore(ipset *IPSet) string {
ipSetRestore.WriteString(fmt.Sprintf("flush %s\n", tmpSetName))
}

setsToDestroy := make([]string, 0, len(tmpSets))
for _, tmpSetName := range tmpSets {
setsToDestroy = append(setsToDestroy, tmpSetName)
}
// need to destroy the sets in a predictable order for unit test!
sort.Strings(setsToDestroy)
for _, tmpSetName := range setsToDestroy {
// finally, destroy the tmp sets.
ipSetRestore.WriteString(fmt.Sprintf("destroy %s\n", tmpSetName))
}
Expand Down

0 comments on commit c139c04

Please sign in to comment.