diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-07-11 15:44:40 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-07-14 11:30:46 +0000 |
| commit | ec20f94ff6effe4c2aab4b4a4ecdfb33180e6e77 (patch) | |
| tree | 57058c12e7ab2ca53553afdbd75d632d98c9c9a6 /syz-cluster/dashboard/handler_test.go | |
| parent | 76718eb73e3d1e2a43363d80ab15366706b6491f (diff) | |
syz-cluster: upload and share build config and log
Diffstat (limited to 'syz-cluster/dashboard/handler_test.go')
| -rw-r--r-- | syz-cluster/dashboard/handler_test.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/syz-cluster/dashboard/handler_test.go b/syz-cluster/dashboard/handler_test.go index 9ef993b93..a1200582e 100644 --- a/syz-cluster/dashboard/handler_test.go +++ b/syz-cluster/dashboard/handler_test.go @@ -4,6 +4,7 @@ package main import ( + "io" "net/http" "net/http/httptest" "testing" @@ -11,6 +12,7 @@ import ( "github.com/google/syzkaller/syz-cluster/pkg/api" "github.com/google/syzkaller/syz-cluster/pkg/app" "github.com/google/syzkaller/syz-cluster/pkg/controller" + "github.com/google/syzkaller/syz-cluster/pkg/db" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -24,9 +26,13 @@ func TestURLs(t *testing.T) { handler, baseURL := testServer(t, env) urlGen := api.NewURLGenerator(baseURL) - var urls []string - urls = append(urls, urlGen.Series(ids.SeriesID)) - findings, err := handler.findingRepo.ListForSession(ctx, ids.SessionID, 0) + urls := []string{urlGen.Series(ids.SeriesID)} + for _, buildID := range []string{ids.BaseBuildID, ids.PatchedBuildID} { + urls = append(urls, urlGen.BuildConfig(buildID)) + urls = append(urls, urlGen.BuildLog(buildID)) + } + + findings, err := handler.findingRepo.ListForSession(ctx, ids.SessionID, db.NoLimit) require.NoError(t, err) for _, finding := range findings { urls = append(urls, urlGen.FindingLog(finding.ID)) @@ -36,9 +42,11 @@ func TestURLs(t *testing.T) { for _, url := range urls { t.Logf("checking %s", url) resp, err := http.Get(url) - assert.NoError(t, err) + body, _ := io.ReadAll(resp.Body) resp.Body.Close() - assert.Equal(t, http.StatusOK, resp.StatusCode, "%q was expected to return HTTP 200", url) + assert.NoError(t, err) + assert.Equal(t, http.StatusOK, resp.StatusCode, + "%q was expected to return HTTP 200, body: %s", url, string(body)) } } |
