From 7adf52984df180ab9bc8140d49aabc0d29a1b635 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 9 Oct 2025 13:08:08 +0200 Subject: syz-cluster: extend dashboard testing Check a few more URLs. Add a TODO about the problem around template error handling - if we stream the output directly to w, we cannot set the 500 status if a problem happens somewhere mid-template. --- syz-cluster/dashboard/handler.go | 3 +++ syz-cluster/dashboard/handler_test.go | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'syz-cluster') diff --git a/syz-cluster/dashboard/handler.go b/syz-cluster/dashboard/handler.go index 58edd5c39..42fad9bbe 100644 --- a/syz-cluster/dashboard/handler.go +++ b/syz-cluster/dashboard/handler.go @@ -393,6 +393,9 @@ func errToStatus(f func(http.ResponseWriter, *http.Request) error) http.HandlerF } else if errors.Is(err, errBadRequest) { http.Error(w, err.Error(), http.StatusBadRequest) } else if err != nil { + // TODO: if the error happened in the template, likely we've already printed + // something to w. Unless we're in streamBlob(), it makes sense to first collect + // the output in some buffer and only dump it after the exit from the handler. http.Error(w, err.Error(), http.StatusInternalServerError) } } diff --git a/syz-cluster/dashboard/handler_test.go b/syz-cluster/dashboard/handler_test.go index a1200582e..8bdb5c318 100644 --- a/syz-cluster/dashboard/handler_test.go +++ b/syz-cluster/dashboard/handler_test.go @@ -26,7 +26,11 @@ func TestURLs(t *testing.T) { handler, baseURL := testServer(t, env) urlGen := api.NewURLGenerator(baseURL) - urls := []string{urlGen.Series(ids.SeriesID)} + urls := []string{ + baseURL, + baseURL + "/stats", + urlGen.Series(ids.SeriesID), + } for _, buildID := range []string{ids.BaseBuildID, ids.PatchedBuildID} { urls = append(urls, urlGen.BuildConfig(buildID)) urls = append(urls, urlGen.BuildLog(buildID)) -- cgit mrf-deployment