diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-04-10 15:09:06 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-04-11 10:07:50 +0000 |
| commit | 4d9e57eb150fee8d24ff32fb4a8a414c77d246e6 (patch) | |
| tree | 9214e0b17c3aa833b9f812b52c5ecf7b28b4d741 /syz-cluster/pkg/api/client.go | |
| parent | dfb5be349af98db984a0944f49896f454e4bc8a6 (diff) | |
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.
Diffstat (limited to 'syz-cluster/pkg/api/client.go')
| -rw-r--r-- | syz-cluster/pkg/api/client.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/syz-cluster/pkg/api/client.go b/syz-cluster/pkg/api/client.go index d0509cfe0..787748e51 100644 --- a/syz-cluster/pkg/api/client.go +++ b/syz-cluster/pkg/api/client.go @@ -9,6 +9,7 @@ import ( "fmt" "io" "net/http" + "net/url" "strings" "time" ) @@ -75,6 +76,16 @@ func (client Client) UploadTestResult(ctx context.Context, req *TestResult) erro return err } +func (client Client) UploadTestArtifacts(ctx context.Context, sessionID, testName string, + tarGzContent io.Reader) error { + v := url.Values{} + v.Add("session", sessionID) + v.Add("test", testName) + url := client.baseURL + "/tests/upload_artifacts?" + v.Encode() + _, err := postMultiPartFile[any](ctx, url, tarGzContent) + return err +} + func (client Client) UploadFinding(ctx context.Context, req *NewFinding) error { _, err := postJSON[NewFinding, any](ctx, client.baseURL+"/findings/upload", req) return err |
