Add a field to track the next allocation during a replacement
This commit is contained in:
parent
2ed4de7e7b
commit
5ad892026a
|
@ -2891,10 +2891,15 @@ func TestServiceSched_Reschedule_Multiple(t *testing.T) {
|
|||
|
||||
// Find the new alloc with ClientStatusPending
|
||||
var pendingAllocs []*structs.Allocation
|
||||
var prevFailedAlloc *structs.Allocation
|
||||
|
||||
for _, alloc := range out {
|
||||
if alloc.ClientStatus == structs.AllocClientStatusPending {
|
||||
pendingAllocs = append(pendingAllocs, alloc)
|
||||
}
|
||||
if alloc.ID == failedAllocId {
|
||||
prevFailedAlloc = alloc
|
||||
}
|
||||
}
|
||||
assert.Equal(1, len(pendingAllocs))
|
||||
newAlloc := pendingAllocs[0]
|
||||
|
@ -2905,6 +2910,9 @@ func TestServiceSched_Reschedule_Multiple(t *testing.T) {
|
|||
assert.Equal(failedAllocId, reschedEvents[len(reschedEvents)-1].PrevAllocID)
|
||||
assert.Equal(failedNodeID, reschedEvents[len(reschedEvents)-1].PrevNodeID)
|
||||
|
||||
// Verify that the next alloc of the failed alloc is the newly rescheduled alloc
|
||||
assert.Equal(newAlloc.ID, prevFailedAlloc.NextAllocation)
|
||||
|
||||
// Mark this alloc as failed again
|
||||
newAlloc.ClientStatus = structs.AllocClientStatusFailed
|
||||
|
||||
|
|
Loading…
Reference in New Issue