Merge pull request #1542 from novilabs/fix-test-job-summary

just checked the known values in job summary instead of doing a deep equals
This commit is contained in:
Diptanu Choudhury 2016-08-09 15:59:39 -07:00 committed by GitHub
commit 56c78f84a4

View file

@ -504,6 +504,7 @@ func TestJobs_JobSummary(t *testing.T) {
// Register the job // Register the job
job := testJob() job := testJob()
taskName := job.TaskGroups[0].Name
_, wm, err := jobs.Register(job, nil) _, wm, err := jobs.Register(job, nil)
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
@ -517,18 +518,12 @@ func TestJobs_JobSummary(t *testing.T) {
} }
assertQueryMeta(t, qm) 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 // Check that the result is what we expect
if !reflect.DeepEqual(&expectedJobSummary, result) { if job.ID != result.JobID {
t.Fatalf("expect: %#v, got: %#v", expectedJobSummary, result) 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)
} }
} }