test(attachments): add concurrent upload load test
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user