From 4d9e57eb150fee8d24ff32fb4a8a414c77d246e6 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 10 Apr 2025 15:09:06 +0200 Subject: syz-cluster: provide API for uploading artifacts archive The archive would be a useful source of debugging information. Provide an HTTP endpoint that accepts a multipart form request with the archived data. Provide an *api.Client method to encapsulate the encoding of the data. Add a test. --- syz-cluster/pkg/controller/api_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'syz-cluster/pkg/controller/api_test.go') diff --git a/syz-cluster/pkg/controller/api_test.go b/syz-cluster/pkg/controller/api_test.go index 2b14fbe5d..fa8491208 100644 --- a/syz-cluster/pkg/controller/api_test.go +++ b/syz-cluster/pkg/controller/api_test.go @@ -4,6 +4,7 @@ package controller import ( + "bytes" "testing" "time" @@ -80,6 +81,24 @@ func TestAPISaveFinding(t *testing.T) { }) } +func TestAPIUploadTestArtifacts(t *testing.T) { + env, ctx := app.TestEnvironment(t) + client := TestServer(t, env) + + _, sessionID := UploadTestSeries(t, ctx, client, testSeries) + buildResp := UploadTestBuild(t, ctx, client, testBuild) + err := client.UploadTestResult(ctx, &api.TestResult{ + SessionID: sessionID, + BaseBuildID: buildResp.ID, + TestName: "test", + Result: api.TestRunning, + Log: []byte("some log"), + }) + assert.NoError(t, err) + err = client.UploadTestArtifacts(ctx, sessionID, "test", bytes.NewReader([]byte("artifacts content"))) + assert.NoError(t, err) +} + var testSeries = &api.Series{ ExtID: "ext-id", AuthorEmail: "some@email.com", -- cgit mrf-deployment