//go:build testbuild package thin import ( "encoding/base64" "math/rand/v2" "testing" "amadan.net/oficina/equipo/internal/wire" ) // Whole-branch fix 1, #5: two incompressible files, each within the // object scan's bound, make an outbound pack past the transfer bound. // The worker measures the pack before it records committed: the step // ends workspace_too_large (terminated, so Retry is offered), nothing // is committed and nothing is uploaded. func TestWorkerEngineeringPackTooLarge(t *testing.T) { scan, pack := workerScanBound, workerPackBound workerScanBound, workerPackBound = 14<<10, 16<<10 t.Cleanup(func() { workerScanBound, workerPackBound = scan, pack }) x := newEngRig(t) rng := rand.New(rand.NewPCG(5, 37)) noise := func() string { b := make([]byte, 12<<10) for i := range b { b[i] = byte(rng.Uint32()) } return base64.StdEncoding.EncodeToString(b) } x.note("bytes:Assets/one.bin|" + noise() + "\nbytes:Assets/two.bin|" + noise()) rep := x.run(t) if rep.State != wire.StepFailed || rep.Reason != wire.ReasonWorkspaceTooLarge || !rep.Termination || rep.CandidateSHA != "" { t.Fatalf("report %+v", rep) } if c := x.committed(); c.CandidateSHA != "" { t.Fatalf("committed %+v", c) } for _, f := range x.outbox(t) { if f.Type == wire.FrameBlob { t.Fatalf("uploaded %s", f.ID) } } }