aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2021-11-22 13:43:17 +0100
committerGitHub <noreply@github.com>2021-11-22 13:43:17 +0100
commit545ab074936db998937ca7b1311c24188bf84635 (patch)
treec130e06b6da1821517abba30a43f644ea289b56b
parent4eb20a4ea7cf78f84d015cefa160aff806c35ec7 (diff)
dashboard/app: check the reporting detach logic (#2883)
Lets extend the test suite to cover the external bugtracker detach logic.
-rw-r--r--dashboard/app/reporting_test.go42
1 files changed, 42 insertions, 0 deletions
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)
+}