From c52b2efbf83e9d66fa9fa7b5416aa8eb4b839f20 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Mon, 19 Dec 2022 15:04:24 +0100 Subject: dashboard: adjust pollClosed behavior for decommissioned namespaces Return bugs from decommissioned namespaces as closed to external reportings. --- dashboard/app/reporting.go | 3 ++- dashboard/app/reporting_test.go | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) 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) +} -- cgit mrf-deployment