tests: use GreaterOrEqual and apply change to other tests
This commit is contained in:
parent
6dfe0f5d3b
commit
61e4f5aaf9
|
@ -219,7 +219,8 @@ func TestDrainer_Simple_ServiceOnly(t *testing.T) {
|
|||
// Check we got the right events
|
||||
node, err := state.NodeByID(nil, n1.ID)
|
||||
require.NoError(err)
|
||||
require.Len(node.Events, 3)
|
||||
// sometimes test gets a duplicate node drain complete event
|
||||
require.GreaterOrEqualf(len(node.Events), 3, "unexpected number of events: %v", node.Events)
|
||||
require.Equal(drainer.NodeDrainEventComplete, node.Events[2].Message)
|
||||
}
|
||||
|
||||
|
@ -314,7 +315,8 @@ func TestDrainer_Simple_ServiceOnly_Deadline(t *testing.T) {
|
|||
// Check we got the right events
|
||||
node, err := state.NodeByID(nil, n1.ID)
|
||||
require.NoError(err)
|
||||
require.Len(node.Events, 3)
|
||||
// sometimes test gets a duplicate node drain complete event
|
||||
require.GreaterOrEqualf(len(node.Events), 3, "unexpected number of events: %v", node.Events)
|
||||
require.Equal(drainer.NodeDrainEventComplete, node.Events[2].Message)
|
||||
require.Contains(node.Events[2].Details, drainer.NodeDrainEventDetailDeadlined)
|
||||
}
|
||||
|
@ -365,7 +367,8 @@ func TestDrainer_DrainEmptyNode(t *testing.T) {
|
|||
// Check we got the right events
|
||||
node, err := state.NodeByID(nil, n1.ID)
|
||||
require.NoError(err)
|
||||
require.Len(node.Events, 3)
|
||||
// sometimes test gets a duplicate node drain complete event
|
||||
require.GreaterOrEqualf(len(node.Events), 3, "unexpected number of events: %v", node.Events)
|
||||
require.Equal(drainer.NodeDrainEventComplete, node.Events[2].Message)
|
||||
}
|
||||
|
||||
|
@ -529,7 +532,8 @@ func TestDrainer_AllTypes_Deadline(t *testing.T) {
|
|||
// Check we got the right events
|
||||
node, err := state.NodeByID(nil, n1.ID)
|
||||
require.NoError(err)
|
||||
require.Len(node.Events, 3)
|
||||
// sometimes test gets a duplicate node drain complete event
|
||||
require.GreaterOrEqualf(len(node.Events), 3, "unexpected number of events: %v", node.Events)
|
||||
require.Equal(drainer.NodeDrainEventComplete, node.Events[2].Message)
|
||||
require.Contains(node.Events[2].Details, drainer.NodeDrainEventDetailDeadlined)
|
||||
}
|
||||
|
@ -698,9 +702,7 @@ func TestDrainer_AllTypes_NoDeadline(t *testing.T) {
|
|||
require.NoError(err)
|
||||
|
||||
// sometimes test gets a duplicate node drain complete event
|
||||
if len(node.Events) < 3 {
|
||||
require.Len(node.Events, 3, "expected at least 3 events")
|
||||
}
|
||||
require.GreaterOrEqualf(len(node.Events), 3, "unexpected number of events: %v", node.Events)
|
||||
require.Equal(drainer.NodeDrainEventComplete, node.Events[2].Message)
|
||||
}
|
||||
|
||||
|
@ -872,7 +874,8 @@ func TestDrainer_AllTypes_Deadline_GarbageCollectedNode(t *testing.T) {
|
|||
// Check we got the right events
|
||||
node, err := state.NodeByID(nil, n1.ID)
|
||||
require.NoError(err)
|
||||
require.Len(node.Events, 3)
|
||||
// sometimes test gets a duplicate node drain complete event
|
||||
require.GreaterOrEqualf(len(node.Events), 3, "unexpected number of events: %v", node.Events)
|
||||
require.Equal(drainer.NodeDrainEventComplete, node.Events[2].Message)
|
||||
require.Contains(node.Events[2].Details, drainer.NodeDrainEventDetailDeadlined)
|
||||
}
|
||||
|
@ -1017,7 +1020,8 @@ func TestDrainer_Batch_TransitionToForce(t *testing.T) {
|
|||
// Check we got the right events
|
||||
node, err := state.NodeByID(nil, n1.ID)
|
||||
require.NoError(err)
|
||||
require.Len(node.Events, 4)
|
||||
// sometimes test gets a duplicate node drain complete event
|
||||
require.GreaterOrEqualf(len(node.Events), 4, "unexpected number of events: %v", node.Events)
|
||||
require.Equal(drainer.NodeDrainEventComplete, node.Events[3].Message)
|
||||
require.Contains(node.Events[3].Details, drainer.NodeDrainEventDetailDeadlined)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue