diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-03-12 13:43:38 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-03-17 18:06:44 +0100 |
| commit | ded8ff151d66a79c087cd3853365d913d35c623a (patch) | |
| tree | fbdeb748da77de2e8a131ea60266e3969571c7e9 | |
| parent | d7e03eccccd1b19d0eb3e1aea43d871c2bed366d (diff) | |
dashboard/app: load crash in loadJob test helper
Will be useful for bisection testing.
Update #501
| -rw-r--r-- | dashboard/app/jobs_test.go | 10 | ||||
| -rw-r--r-- | dashboard/app/util_test.go | 9 |
2 files changed, 12 insertions, 7 deletions
diff --git a/dashboard/app/jobs_test.go b/dashboard/app/jobs_test.go index e74a6d0fb..56eb1fa6d 100644 --- a/dashboard/app/jobs_test.go +++ b/dashboard/app/jobs_test.go @@ -119,7 +119,7 @@ func TestJob(t *testing.T) { c.client2.JobDone(jobDoneReq) { - dbJob, dbBuild := c.loadJob(pollResp.ID) + dbJob, dbBuild, _ := c.loadJob(pollResp.ID) patchLink := externalLink(c.ctx, textPatch, dbJob.Patch) kernelConfigLink := externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig) logLink := externalLink(c.ctx, textCrashLog, dbJob.CrashLog) @@ -160,7 +160,7 @@ patch: %[1]v } c.client2.JobDone(jobDoneReq) { - dbJob, dbBuild := c.loadJob(pollResp.ID) + dbJob, dbBuild, _ := c.loadJob(pollResp.ID) patchLink := externalLink(c.ctx, textPatch, dbJob.Patch) kernelConfigLink := externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig) msg := c.pollEmailBug() @@ -195,7 +195,7 @@ patch: %[1]v } c.client2.JobDone(jobDoneReq) { - dbJob, dbBuild := c.loadJob(pollResp.ID) + dbJob, dbBuild, _ := c.loadJob(pollResp.ID) patchLink := externalLink(c.ctx, textPatch, dbJob.Patch) errorLink := externalLink(c.ctx, textError, dbJob.Error) kernelConfigLink := externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig) @@ -234,7 +234,7 @@ patch: %[3]v } c.client2.JobDone(jobDoneReq) { - dbJob, dbBuild := c.loadJob(pollResp.ID) + dbJob, dbBuild, _ := c.loadJob(pollResp.ID) patchLink := externalLink(c.ctx, textPatch, dbJob.Patch) kernelConfigLink := externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig) msg := c.pollEmailBug() @@ -291,7 +291,7 @@ func TestJobWithoutPatch(t *testing.T) { } c.client2.JobDone(jobDoneReq) { - _, dbBuild := c.loadJob(pollResp.ID) + _, dbBuild, _ := c.loadJob(pollResp.ID) kernelConfigLink := externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig) msg := c.pollEmailBug() c.expectEQ(len(msg.Attachments), 0) diff --git a/dashboard/app/util_test.go b/dashboard/app/util_test.go index 2f9d959c3..b9abd34fa 100644 --- a/dashboard/app/util_test.go +++ b/dashboard/app/util_test.go @@ -213,7 +213,7 @@ func (c *Ctx) loadBug(extID string) (*Bug, *Crash, *Build) { return bug, crash, build } -func (c *Ctx) loadJob(extID string) (*Job, *Build) { +func (c *Ctx) loadJob(extID string) (*Job, *Build, *Crash) { jobKey, err := jobID2Key(c.ctx, extID) if err != nil { c.t.Fatalf("failed to create job key: %v", err) @@ -226,7 +226,12 @@ func (c *Ctx) loadJob(extID string) (*Job, *Build) { if err != nil { c.t.Fatalf("failed to load build: %v", err) } - return job, build + crash := new(Crash) + crashKey := datastore.NewKey(c.ctx, "Crash", "", job.CrashID, jobKey.Parent()) + if err := datastore.Get(c.ctx, crashKey, crash); err != nil { + c.t.Fatalf("failed to load crash for job: %v", err) + } + return job, build, crash } func (c *Ctx) checkURLContents(url string, want []byte) { |
