Correct the status description and modify time of canceled evals. (#17071)
Fix for #17070. Corrected the status description and modify time of evals which are canceled due to another eval having completed in the meantime.
This commit is contained in:
parent
2fbbac5dd8
commit
9c1c2cb5d2
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
bug: Corrected status description and modification time for canceled evaluations
|
||||||
|
```
|
|
@ -3160,11 +3160,12 @@ func (s *StateStore) nestedUpsertEval(txn *txn, index uint64, eval *structs.Eval
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go through and update the evals
|
// Go through and update the evals
|
||||||
for _, eval := range blocked {
|
for _, blockedEval := range blocked {
|
||||||
newEval := eval.Copy()
|
newEval := blockedEval.Copy()
|
||||||
newEval.Status = structs.EvalStatusCancelled
|
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.ModifyIndex = index
|
||||||
|
newEval.ModifyTime = eval.ModifyTime
|
||||||
|
|
||||||
if err := txn.Insert("evals", newEval); err != nil {
|
if err := txn.Insert("evals", newEval); err != nil {
|
||||||
return fmt.Errorf("eval insert failed: %v", err)
|
return fmt.Errorf("eval insert failed: %v", err)
|
||||||
|
|
|
@ -4176,6 +4176,14 @@ func TestStateStore_UpsertEvals_CancelBlocked(t *testing.T) {
|
||||||
t.Fatalf("bad: %#v %#v", out1, out2)
|
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) {
|
if watchFired(ws) {
|
||||||
t.Fatalf("bad")
|
t.Fatalf("bad")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue