oficina / equipo Public

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

Plain git — no account needed to clone.

Download

Download this file

1package chat
2
3import (
4 "testing"
5
6 "amadan.net/oficina/equipo/internal/wire"
7)
8
9// A candidate is unfinished when the Engineering step that made it ran
10// out of time; a Copy commit, a rebase or a fix round on top keeps it
11// unfinished (Review is still told), until a Review has judged unfinished
12// work and an Engineering round after it finished.
13func TestUnfinishedSurvivesCopy(t *testing.T) {
14 timedOut := stepRecord{Specialist: wire.SpecialistEngineering, State: wire.StepDone, Pushed: true, CandidateSHA: "eng", Reason: "step_timeout"}
15 copied := stepRecord{Specialist: wire.SpecialistCopy, State: wire.StepDone, Pushed: true, CandidateSHA: "copy"}
16 finished := stepRecord{Specialist: wire.SpecialistEngineering, State: wire.StepDone, Pushed: true, CandidateSHA: "fix", Round: 1}
17 reviewed := stepRecord{Specialist: wire.SpecialistReview, State: wire.StepDone, CandidateSHA: "copy", Verdict: wire.VerdictChanges}
18 rebased := stepRecord{Specialist: wire.SpecialistEngineering, State: wire.StepDone, Pushed: true, CandidateSHA: "rebased", Rebase: true}
19 for name, c := range map[string]struct {
20 steps []stepRecord
21 want bool
22 }{
23 "timed out": {[]stepRecord{timedOut}, true},
24 "copy on top": {[]stepRecord{timedOut, copied}, true},
25 "fixed, not yet reviewed": {[]stepRecord{timedOut, copied, finished}, true},
26 "reviewed, then fixed": {[]stepRecord{timedOut, copied, reviewed, finished}, false},
27 "reviewed, not fixed": {[]stepRecord{timedOut, copied, reviewed}, true},
28 "finished": {[]stepRecord{finished}, false},
29 "copy on a finished": {[]stepRecord{finished, copied}, false},
30 "rebased": {[]stepRecord{timedOut, copied, rebased}, true},
31 "rebased, finished": {[]stepRecord{finished, rebased}, false},
32 } {
33 if got := unfinished(progressOf(c.steps)); got != c.want {
34 t.Errorf("%s: unfinished %v, want %v", name, got, c.want)
35 }
36 }
37}
38