From 9fb2733de88dfa62b1b5a53d88ba4584b16a193f Mon Sep 17 00:00:00 2001 From: Cameron Davison Date: Sun, 7 Aug 2016 22:51:24 -0500 Subject: [PATCH 1/2] just checked the known values in job summary instead of doing a deep equals --- api/jobs_test.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/api/jobs_test.go b/api/jobs_test.go index 11efc7a36..8f88f7853 100644 --- a/api/jobs_test.go +++ b/api/jobs_test.go @@ -502,6 +502,7 @@ func TestJobs_JobSummary(t *testing.T) { // Register the job job := testJob() + taskName := job.TaskGroups[0].Name _, wm, err := jobs.Register(job, nil) if err != nil { t.Fatalf("err: %s", err) @@ -515,18 +516,12 @@ func TestJobs_JobSummary(t *testing.T) { } assertQueryMeta(t, qm) - expectedJobSummary := JobSummary{ - JobID: job.ID, - Summary: map[string]TaskGroupSummary{ - job.TaskGroups[0].Name: {}, - }, - CreateIndex: result.CreateIndex, - ModifyIndex: result.ModifyIndex, - } - // Check that the result is what we expect - if !reflect.DeepEqual(&expectedJobSummary, result) { - t.Fatalf("expect: %#v, got: %#v", expectedJobSummary, result) + if (job.ID != result.JobID) { + t.Fatalf("err: expected job id of %s saw %s", job.ID, result.JobID) + } + if _, ok := result.Summary[taskName]; !ok { + t.Fatalf("err: unable to find %s key in job summary", taskName) } } From bf15a9356d1b4a6210f567b1a6dd92095ca9a75a Mon Sep 17 00:00:00 2001 From: Cameron Davison Date: Mon, 8 Aug 2016 09:24:24 -0500 Subject: [PATCH 2/2] go fmt error --- api/jobs_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/jobs_test.go b/api/jobs_test.go index 8f88f7853..69af59cac 100644 --- a/api/jobs_test.go +++ b/api/jobs_test.go @@ -517,7 +517,7 @@ func TestJobs_JobSummary(t *testing.T) { assertQueryMeta(t, qm) // Check that the result is what we expect - if (job.ID != result.JobID) { + if job.ID != result.JobID { t.Fatalf("err: expected job id of %s saw %s", job.ID, result.JobID) } if _, ok := result.Summary[taskName]; !ok {