Show info about remaining reschedule attempts relative to alloc modify time
This commit is contained in:
parent
5714a6b8bf
commit
36b8e91625
|
@ -287,8 +287,9 @@ func formatAllocBasicInfo(alloc *api.Allocation, client *api.Client, uuidLength
|
|||
fmt.Sprintf("Allocation Time|%s", alloc.Metrics.AllocationTime),
|
||||
fmt.Sprintf("Failures|%d", alloc.Metrics.CoalescedFailures))
|
||||
if alloc.RescheduleTracker != nil && len(alloc.RescheduleTracker.Events) > 0 {
|
||||
basic = append(basic,
|
||||
fmt.Sprintf("Previous Reschedule Attempts|%d", len(alloc.RescheduleTracker.Events)))
|
||||
attempts, total := alloc.RescheduleInfo(time.Unix(0, alloc.ModifyTime))
|
||||
reschedInfo := fmt.Sprintf("Remaining Reschedule Attempts|%d/%d", attempts, total)
|
||||
basic = append(basic, reschedInfo)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -183,12 +183,7 @@ func TestAllocStatusCommand_Run(t *testing.T) {
|
|||
a.RescheduleTracker = &structs.RescheduleTracker{
|
||||
Events: []*structs.RescheduleEvent{
|
||||
{
|
||||
RescheduleTime: time.Now().Add(-5 * time.Minute).UTC().UnixNano(),
|
||||
PrevAllocID: uuid.Generate(),
|
||||
PrevNodeID: uuid.Generate(),
|
||||
},
|
||||
{
|
||||
RescheduleTime: time.Now().Add(-5 * time.Minute).UTC().UnixNano(),
|
||||
RescheduleTime: time.Now().Add(-2 * time.Minute).UTC().UnixNano(),
|
||||
PrevAllocID: uuid.Generate(),
|
||||
PrevNodeID: uuid.Generate(),
|
||||
},
|
||||
|
@ -206,7 +201,7 @@ func TestAllocStatusCommand_Run(t *testing.T) {
|
|||
t.Fatalf("expected exit 0, got: %d", code)
|
||||
}
|
||||
out = ui.OutputWriter.String()
|
||||
require.Contains(out, "Previous Reschedule Attempts")
|
||||
require.Contains(out, "Remaining Reschedule Attempts = 1/2")
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue