Skip to content

Commit

Permalink
k8s: fix test flake in TestGenerateToCIDRFromEndpoint.
Browse files Browse the repository at this point in the history
Fixes: #21145

Signed-off-by: Tom Hadlaw <tom.hadlaw@isovalent.com>
  • Loading branch information
tommyp1ckles authored and nebril committed Sep 12, 2022
1 parent 43e4a3b commit c9a62af
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/k8s/rule_translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,14 @@ func (s *K8sSuite) TestGenerateToCIDRFromEndpoint(c *C) {
c.Assert(err, IsNil)
_, epIP2Prefix, err := net.ParseCIDR(epIP2 + "/32")
c.Assert(err, IsNil)
c.Assert(prefixesToAllocate[0].String(), Equals, epIP1Prefix.String())
c.Assert(prefixesToAllocate[1].String(), Equals, epIP2Prefix.String())
prefixStrings := []string{}
for _, ipnet := range prefixesToAllocate {
prefixStrings = append(prefixStrings, ipnet.String())
}
c.Assert(len(prefixesToAllocate), Equals, 2)
sort.Strings(prefixStrings)
c.Assert(prefixStrings[0], Equals, epIP1Prefix.String())
c.Assert(prefixStrings[1], Equals, epIP2Prefix.String())

cidrs = rule.ToCIDRSet.StringSlice()
sort.Strings(cidrs)
Expand Down

0 comments on commit c9a62af

Please sign in to comment.