Skip to content

Commit 7adf529

Browse files
committed
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.
1 parent 03f955c commit 7adf529

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

syz-cluster/dashboard/handler.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,9 @@ func errToStatus(f func(http.ResponseWriter, *http.Request) error) http.HandlerF
393393
} else if errors.Is(err, errBadRequest) {
394394
http.Error(w, err.Error(), http.StatusBadRequest)
395395
} else if err != nil {
396+
// TODO: if the error happened in the template, likely we've already printed
397+
// something to w. Unless we're in streamBlob(), it makes sense to first collect
398+
// the output in some buffer and only dump it after the exit from the handler.
396399
http.Error(w, err.Error(), http.StatusInternalServerError)
397400
}
398401
}

syz-cluster/dashboard/handler_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ func TestURLs(t *testing.T) {
2626
handler, baseURL := testServer(t, env)
2727
urlGen := api.NewURLGenerator(baseURL)
2828

29-
urls := []string{urlGen.Series(ids.SeriesID)}
29+
urls := []string{
30+
baseURL,
31+
baseURL + "/stats",
32+
urlGen.Series(ids.SeriesID),
33+
}
3034
for _, buildID := range []string{ids.BaseBuildID, ids.PatchedBuildID} {
3135
urls = append(urls, urlGen.BuildConfig(buildID))
3236
urls = append(urls, urlGen.BuildLog(buildID))

0 commit comments

Comments
 (0)