Added test to make sure summary gets deleted when job gets deleted

This commit is contained in:
Diptanu Choudhury 2016-07-02 18:10:12 -07:00
parent 0606840080
commit 837b70f285

View file

@ -458,6 +458,26 @@ func TestStateStore_UpdateUpsertJob_Job(t *testing.T) {
t.Fatalf("bad: %d", index)
}
// Test that the job summary remains the same if the job is updated but
// count remains same
summary, err := state.JobSummary(job.ID)
if err != nil {
t.Fatalf("err: %v", err)
}
if summary == nil {
t.Fatalf("nil summary")
}
if summary.JobID != job.ID {
t.Fatalf("bad summary id: %v", summary.JobID)
}
webTgSummary, ok := summary.Summary["web"]
if !ok {
t.Fatalf("nil summary for task group")
}
if webTgSummary.Queued != 10 {
t.Fatalf("wrong summary: %#v", webTgSummary)
}
notify.verify(t)
}
@ -497,6 +517,14 @@ func TestStateStore_DeleteJob_Job(t *testing.T) {
t.Fatalf("bad: %d", index)
}
summary, err := state.JobSummary(job.ID)
if err != nil {
t.Fatalf("err: %v", err)
}
if summary != nil {
t.Fatalf("expected summary to be nil, but got: %v", summary)
}
notify.verify(t)
}