From e30f059fce4242956bd289e6690b150ddc6cd0d5 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 15 Jan 2026 12:50:59 +0100 Subject: 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. --- dashboard/app/reporting_test.go | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'dashboard/app/reporting_test.go') 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) + } +} -- cgit mrf-deployment