Add a field to track the next allocation during a replacement

This commit is contained in:
Preetha Appan 2018-01-24 14:56:57 -06:00
parent 2ed4de7e7b
commit 5ad892026a
No known key found for this signature in database
GPG Key ID: 9F7C19990A50EAFC
1 changed files with 8 additions and 0 deletions

View File

@ -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