From 545ab074936db998937ca7b1311c24188bf84635 Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Mon, 22 Nov 2021 13:43:17 +0100 Subject: dashboard/app: check the reporting detach logic (#2883) Lets extend the test suite to cover the external bugtracker detach logic. --- dashboard/app/reporting_test.go | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/dashboard/app/reporting_test.go b/dashboard/app/reporting_test.go index 1ae800321..453dbb1c7 100644 --- a/dashboard/app/reporting_test.go +++ b/dashboard/app/reporting_test.go @@ -721,3 +721,45 @@ func TestAltTitles7(t *testing.T) { c.expectEQ(rep.Title, crash1.Title) c.expectEQ(rep.Log, crash2.Log) } + +func TestDetachExternalTracker(t *testing.T) { + c := NewCtx(t) + defer c.Close() + + build := testBuild(1) + c.client.UploadBuild(build) + + crash1 := testCrash(build, 1) + c.client.ReportCrash(crash1) + + // Get single report for "test" type. + resp, _ := c.client.ReportingPollBugs("test") + c.expectEQ(len(resp.Reports), 1) + rep1 := resp.Reports[0] + c.expectNE(rep1.ID, "") + c.expectEQ(string(rep1.Config), `{"Index":1}`) + + // Signal detach_reporting for current bug. + reply, _ := c.client.ReportingUpdate(&dashapi.BugUpdate{ + ID: rep1.ID, + Status: dashapi.BugStatusUpstream, + ReproLevel: dashapi.ReproLevelNone, + Link: "http://URI/1", + CrashID: rep1.CrashID, + }) + c.expectEQ(reply.OK, true) + + // Now add syz repro to check it doesn't use first reporting. + crash1.ReproOpts = []byte("some opts") + crash1.ReproSyz = []byte("getpid()") + c.client.ReportCrash(crash1) + + // Fetch bug and check reporting path (Config) is different. + rep2 := c.client.pollBug() + c.expectNE(rep2.ID, "") + c.expectEQ(string(rep2.Config), `{"Index":2}`) + + closed, _ := c.client.ReportingPollClosed([]string{rep1.ID, rep2.ID}) + c.expectEQ(len(closed), 1) + c.expectEQ(closed[0], rep1.ID) +} -- cgit mrf-deployment