diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2022-12-19 15:04:24 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2022-12-19 15:20:29 +0100 |
| commit | c52b2efbf83e9d66fa9fa7b5416aa8eb4b839f20 (patch) | |
| tree | 8be760309be54399e15b960e932a314cfbb7d88b | |
| parent | 05494336991504e3c6137b89eeddd492e17af6b6 (diff) | |
dashboard: adjust pollClosed behavior for decommissioned namespaces
Return bugs from decommissioned namespaces as closed to external
reportings.
| -rw-r--r-- | dashboard/app/reporting.go | 3 | ||||
| -rw-r--r-- | dashboard/app/reporting_test.go | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/dashboard/app/reporting.go b/dashboard/app/reporting.go index 53ecd0888..273ac3dec 100644 --- a/dashboard/app/reporting.go +++ b/dashboard/app/reporting.go @@ -734,7 +734,8 @@ func reportingPollClosed(c context.Context, ids []string) ([]string, error) { log.Errorf(c, "%v", err) break } - if bug.Status >= BugStatusFixed || !bugReporting.Closed.IsZero() { + if bug.Status >= BugStatusFixed || !bugReporting.Closed.IsZero() || + config.Namespaces[bug.Namespace].Decommissioned { closed = append(closed, bugReporting.ID) } break diff --git a/dashboard/app/reporting_test.go b/dashboard/app/reporting_test.go index d8f574994..0768d9105 100644 --- a/dashboard/app/reporting_test.go +++ b/dashboard/app/reporting_test.go @@ -1005,3 +1005,26 @@ func TestFullBugInfo(t *testing.T) { c.expectEQ(info.Crashes[i].Report, report) } } + +func TestReportDecommissionedBugs(t *testing.T) { + c := NewCtx(t) + defer c.Close() + + build := testBuild(1) + c.client.UploadBuild(build) + + crash := testCrash(build, 1) + c.client.ReportCrash(crash) + rep := c.client.pollBug() + + closed, _ := c.client.ReportingPollClosed([]string{rep.ID}) + c.expectEQ(len(closed), 0) + + // And now let's decommission the namespace. + config.Namespaces[rep.Namespace].Decommissioned = true + defer func() { config.Namespaces[rep.Namespace].Decommissioned = false }() + + closed, _ = c.client.ReportingPollClosed([]string{rep.ID}) + c.expectEQ(len(closed), 1) + c.expectEQ(closed[0], rep.ID) +} |
