Form field (Swedish preselected, Other = auto) read before the file part and refused before anything is spooled if outside the closed set; stored on the row (migration 021, CHECK constraint, default sv for history); carried on the Job and the worker's context; shown on the status page. Feature scenarios and the coverage map are updated, and ADR-033/034 amended. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
33 lines
1.2 KiB
Go
33 lines
1.2 KiB
Go
package uploads_test
|
|
|
|
// The limits production runs on are the DEFAULTS: nothing outside tests sets
|
|
// MaxReceives or MaxReceivesPerUser. Pinned here with the literal numbers, so changing a
|
|
// default is a visible decision (#47 review). With 4 receives, 20 queued and 1 running at
|
|
// the 200 MiB cap, the spool needs ~5 GiB of the 6 Gi emptyDir (infra); raising any of
|
|
// them or TAPIR_UPLOAD_MAX_BYTES must revisit that arithmetic.
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
"testing"
|
|
"time"
|
|
|
|
"git.d-ma.be/mathias/tapir/internal/domain"
|
|
"git.d-ma.be/mathias/tapir/internal/uploads"
|
|
)
|
|
|
|
func TestNewIntake_DefaultsAllowTwoReceivesPerUserAndFourOverall(t *testing.T) {
|
|
r := newRig(t)
|
|
in := uploads.NewIntake(r.st, r.pr, r.sub, uploads.Limits{MaxBytes: 1024, MaxDuration: time.Hour}, r.tmp)
|
|
startSlowReceive(t, r, in, "a", 1)
|
|
startSlowReceive(t, r, in, "a", 2)
|
|
|
|
_, err := in.Accept(context.Background(), "a", "t", domain.LangSwedish, strings.NewReader("x"))
|
|
requireBusy(t, err) // a third body from one user
|
|
|
|
startSlowReceive(t, r, in, "b", 3)
|
|
startSlowReceive(t, r, in, "b", 4)
|
|
_, err = in.Accept(context.Background(), "c", "t", domain.LangSwedish, strings.NewReader("x"))
|
|
requireBusy(t, err) // a fifth body overall
|
|
}
|