diff --git a/command/monitor.go b/command/monitor.go index e3e715c75..0db947e22 100644 --- a/command/monitor.go +++ b/command/monitor.go @@ -131,21 +131,23 @@ func (m *monitor) update(update *evalState) { } } - // Check if the status changed - if existing.status != update.status { + // Check if the status changed. We skip any transitions to pending status. + if existing.status != "" && + update.status != structs.AllocClientStatusPending && + existing.status != update.status { m.ui.Output(fmt.Sprintf("Evaluation status changed: %q -> %q", existing.status, update.status)) } // Check if the wait time is different if existing.wait == 0 && update.wait != 0 { - m.ui.Output(fmt.Sprintf("Waiting %s before running eval", + m.ui.Output(fmt.Sprintf("Evaluation delay is %s", update.wait)) } - // Check if the node changed + // Check if the evaluation was triggered by a node if existing.node == "" && update.node != "" { - m.ui.Output(fmt.Sprintf("Evaluation was assigned node ID %q", + m.ui.Output(fmt.Sprintf("Evaluation triggered by node %q", update.node)) } } diff --git a/command/monitor_test.go b/command/monitor_test.go index 562d1a0a4..ef8fc253e 100644 --- a/command/monitor_test.go +++ b/command/monitor_test.go @@ -24,15 +24,17 @@ func TestMonitor_Update_Eval(t *testing.T) { // Logs were output out := ui.OutputWriter.String() - if !strings.Contains(out, "pending") { - t.Fatalf("missing status\n\n%s", out) - } if !strings.Contains(out, "node1") { t.Fatalf("missing node\n\n%s", out) } if !strings.Contains(out, "10s") { t.Fatalf("missing eval wait\n\n%s", out) } + + // Transition to pending should not be logged + if strings.Contains(out, structs.EvalStatusPending) { + t.Fatalf("should skip status\n\n%s", out) + } ui.OutputWriter.Reset() // No logs sent if no update