it is possible to have more than 1 eval if the eval fails, use the last one

This commit is contained in:
Cameron Davison
2016-08-07 22:30:48 -05:00
parent f847db6d5d
commit f52335700b

View File

@@ -281,9 +281,11 @@ func TestJobs_Evaluations(t *testing.T) {
}
assertQueryMeta(t, qm)
// Check that we got the evals back
if n := len(evals); n == 0 || evals[0].ID != evalID {
t.Fatalf("expected 1 eval (%s), got: %#v", evalID, evals)
// Check that we got the evals back, evals are in order most recent to least recent
// so the last eval is the original registered eval
idx := len(evals) - 1
if n := len(evals); n == 0 || evals[idx].ID != evalID {
t.Fatalf("expected >= 1 eval (%s), got: %#v", evalID, evals[idx])
}
}