test(attachments): add concurrent upload load test

This commit is contained in:
kk10
2026-11-03 14:04:32 +03:00
parent 5f3efc63a0
commit b19e64cc29
3 changed files with 206 additions and 26 deletions
-26
View File
@@ -5,9 +5,6 @@ package studenttests_test
import (
"bytes"
"encoding/json"
"image"
"image/color"
"image/png"
"net/http"
"net/url"
"testing"
@@ -19,29 +16,6 @@ import (
const maxUploadBytes = 10 * 1024 * 1024
func makePNG(t *testing.T, width, height int) []byte {
t.Helper()
img := image.NewRGBA(image.Rect(0, 0, width, height))
for y := 0; y < height; y++ {
for x := 0; x < width; x++ {
img.Set(x, y, color.RGBA{
R: uint8((x * 7) % 256),
G: uint8((y * 13) % 256),
B: uint8((x + y) % 256),
A: 255,
})
}
}
var buf bytes.Buffer
if err := png.Encode(&buf, img); err != nil {
t.Fatalf("encode png: %v", err)
}
return buf.Bytes()
}
func uploadAttachment(
t *testing.T,
actor testUser,