From f52335700bc6d02b77bfe84d4a565656d55684ec Mon Sep 17 00:00:00 2001 From: Cameron Davison Date: Sun, 7 Aug 2016 22:30:48 -0500 Subject: [PATCH] it is possible to have more than 1 eval if the eval fails, use the last one --- api/jobs_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/jobs_test.go b/api/jobs_test.go index 11efc7a36..205a7750a 100644 --- a/api/jobs_test.go +++ b/api/jobs_test.go @@ -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]) } }