diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2026-01-15 12:50:59 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2026-01-15 12:26:32 +0000 |
| commit | e30f059fce4242956bd289e6690b150ddc6cd0d5 (patch) | |
| tree | f68cba31f5d79a20e4dea1fe7860595de652a987 /dashboard/app/reporting_test.go | |
| parent | 41cfbc00ddb9f36db18d9e02ddd517d65ae1177c (diff) | |
dashboard: add a manuallyUpstreamed helper
This helper function can be used in the reporting filtering rules to
skip certain reporting stages depending on whether the previous stage(s)
have been manually upstreamed.
Add tests that it does have the intended effect.
Cc #6554.
Diffstat (limited to 'dashboard/app/reporting_test.go')
| -rw-r--r-- | dashboard/app/reporting_test.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/dashboard/app/reporting_test.go b/dashboard/app/reporting_test.go index b1400c705..211797488 100644 --- a/dashboard/app/reporting_test.go +++ b/dashboard/app/reporting_test.go @@ -1417,3 +1417,53 @@ Blocks diff, Path `, msg.Body) } + +func TestSkipStage(t *testing.T) { + // The test ensures that manuallyUpstreamed works as intended in reporting filters. + c := NewCtx(t) + defer c.Close() + client := c.makeClient(clientSkipStage, keySkipStage, true) + + build := testBuild(1) + client.UploadBuild(build) + + { + // Normal scenario - manual upstreaming. + client.ReportCrash(testCrash(build, 1)) + rep := client.pollBug() + c.expectEQ(string(rep.Config), `{"Index":1}`) + c.client.updateBug(rep.ID, dashapi.BugStatusUpstream, "") + client.pollNotifs(0) + rep = client.pollBug() + c.expectEQ(string(rep.Config), `{"Index":3}`) + c.client.updateBug(rep.ID, dashapi.BugStatusInvalid, "") + } + + { + // Auto-upstreamed. + client.ReportCrash(testCrash(build, 2)) + rep := client.pollBug() + c.expectEQ(string(rep.Config), `{"Index":1}`) + c.advanceTime(5 * 24 * time.Hour) + notifs := client.pollNotifs(1) + reply, _ := client.ReportingUpdate(&dashapi.BugUpdate{ + ID: notifs[0].ID, + Status: dashapi.BugStatusUpstream, + Notification: true, + }) + c.expectEQ(reply.OK, true) + rep = client.pollBug() + c.expectEQ(string(rep.Config), `{"Index":2}`) + c.client.updateBug(rep.ID, dashapi.BugStatusInvalid, "") + } + + { + // Manually invalidated. + client.ReportCrash(testCrash(build, 3)) + rep := client.pollBug() + c.expectEQ(string(rep.Config), `{"Index":1}`) + c.client.updateBug(rep.ID, dashapi.BugStatusInvalid, "") + client.pollNotifs(0) + client.pollBugs(0) + } +} |
