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
@@ -4,6 +4,9 @@ import (
"bytes"
"encoding/json"
"flag"
"image"
"image/color"
"image/png"
"io"
"net/http"
"strings"
@@ -208,3 +211,26 @@ func sendLoadMessage(
return httpClient.Do(req)
}
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()
}