diff --git a/.changelog/17071.txt b/.changelog/17071.txt new file mode 100644 index 000000000..9508299cd --- /dev/null +++ b/.changelog/17071.txt @@ -0,0 +1,3 @@ +```release-note:bug +bug: Corrected status description and modification time for canceled evaluations +``` diff --git a/nomad/state/state_store.go b/nomad/state/state_store.go index 7d1c7d1d2..cfae8e47a 100644 --- a/nomad/state/state_store.go +++ b/nomad/state/state_store.go @@ -3160,11 +3160,12 @@ func (s *StateStore) nestedUpsertEval(txn *txn, index uint64, eval *structs.Eval } // Go through and update the evals - for _, eval := range blocked { - newEval := eval.Copy() + for _, blockedEval := range blocked { + newEval := blockedEval.Copy() newEval.Status = structs.EvalStatusCancelled - newEval.StatusDescription = fmt.Sprintf("evaluation %q successful", newEval.ID) + newEval.StatusDescription = fmt.Sprintf("evaluation %q successful", eval.ID) newEval.ModifyIndex = index + newEval.ModifyTime = eval.ModifyTime if err := txn.Insert("evals", newEval); err != nil { return fmt.Errorf("eval insert failed: %v", err) diff --git a/nomad/state/state_store_test.go b/nomad/state/state_store_test.go index 5afa1e61c..4f6f9aeaf 100644 --- a/nomad/state/state_store_test.go +++ b/nomad/state/state_store_test.go @@ -4176,6 +4176,14 @@ func TestStateStore_UpsertEvals_CancelBlocked(t *testing.T) { t.Fatalf("bad: %#v %#v", out1, out2) } + if !strings.Contains(out1.StatusDescription, eval.ID) || !strings.Contains(out2.StatusDescription, eval.ID) { + t.Fatalf("bad status description %#v %#v", out1, out2) + } + + if out1.ModifyTime != eval.ModifyTime || out2.ModifyTime != eval.ModifyTime { + t.Fatalf("bad modify time %#v %#v", out1, out2) + } + if watchFired(ws) { t.Fatalf("bad") }