oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1//go:build testbuild
2
3package thin
4
5import (
6 "encoding/base64"
7 "math/rand/v2"
8 "testing"
9
10 "amadan.net/oficina/equipo/internal/wire"
11)
12
13// Whole-branch fix 1, #5: two incompressible files, each within the
14// object scan's bound, make an outbound pack past the transfer bound.
15// The worker measures the pack before it records committed: the step
16// ends workspace_too_large (terminated, so Retry is offered), nothing
17// is committed and nothing is uploaded.
18func TestWorkerEngineeringPackTooLarge(t *testing.T) {
19 scan, pack := workerScanBound, workerPackBound
20 workerScanBound, workerPackBound = 14<<10, 16<<10
21 t.Cleanup(func() { workerScanBound, workerPackBound = scan, pack })
22 x := newEngRig(t)
23 rng := rand.New(rand.NewPCG(5, 37))
24 noise := func() string {
25 b := make([]byte, 12<<10)
26 for i := range b {
27 b[i] = byte(rng.Uint32())
28 }
29 return base64.StdEncoding.EncodeToString(b)
30 }
31 x.note("bytes:Assets/one.bin|" + noise() + "\nbytes:Assets/two.bin|" + noise())
32 rep := x.run(t)
33 if rep.State != wire.StepFailed || rep.Reason != wire.ReasonWorkspaceTooLarge || !rep.Termination || rep.CandidateSHA != "" {
34 t.Fatalf("report %+v", rep)
35 }
36 if c := x.committed(); c.CandidateSHA != "" {
37 t.Fatalf("committed %+v", c)
38 }
39 for _, f := range x.outbox(t) {
40 if f.Type == wire.FrameBlob {
41 t.Fatalf("uploaded %s", f.ID)
42 }
43 }
44}
45