Skip to content

Commit

Permalink
eni: Fix node manager test
Browse files Browse the repository at this point in the history
The test was failing due resulting values being greater then expected,
however it is evident that `minAllocate` is a minimum value and should
be treated as such.

Fixes: #11560

Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com>
  • Loading branch information
errordeveloper authored and christarazi committed May 29, 2020
1 parent 138d556 commit f719893
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/aws/eni/node_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,8 @@ func (e *ENISuite) TestNodeManagerManyNodes(c *check.C) {

node := mngr.Get(s.name)
c.Assert(node, check.Not(check.IsNil))
if node.Stats().AvailableIPs != minAllocate {
c.Errorf("Node %s allocation mismatch. expected: %d allocated: %d", s.name, minAllocate, node.Stats().AvailableIPs)
if node.Stats().AvailableIPs < minAllocate {
c.Errorf("Node %s allocation shortage. expected at least: %d, allocated: %d", s.name, minAllocate, node.Stats().AvailableIPs)
c.Fail()
}
c.Assert(node.Stats().UsedIPs, check.Equals, 0)
Expand All @@ -624,7 +624,10 @@ func (e *ENISuite) TestNodeManagerManyNodes(c *check.C) {
c.Assert(metricsapi.Nodes("in-deficit"), check.Equals, 0)
c.Assert(metricsapi.Nodes("at-capacity"), check.Equals, 0)

c.Assert(metricsapi.AllocatedIPs("available"), check.Equals, numNodes*minAllocate)
if allocated := metricsapi.AllocatedIPs("available"); allocated < numNodes*minAllocate {
c.Errorf("IP %s allocation shortage. expected at least: %d, allocated: %d", numNodes*minAllocate, allocated)
c.Fail()
}
c.Assert(metricsapi.AllocatedIPs("needed"), check.Equals, 0)
c.Assert(metricsapi.AllocatedIPs("used"), check.Equals, 0)

Expand Down

0 comments on commit f719893

Please sign in to comment.