Download this file
| 1 | package mergegate |
| 2 | |
| 3 | import ( |
| 4 | "slices" |
| 5 | "testing" |
| 6 | |
| 7 | "amadan.net/oficina/equipo/internal/wire" |
| 8 | ) |
| 9 | |
| 10 | // A candidate made on a Mac worker never merges by policy: its executor |
| 11 | // cannot enforce immutable base gates (injection defences), whatever |
| 12 | // else holds, checked or not. The person's Merge still acts. |
| 13 | func TestDecideMacMadeAsks(t *testing.T) { |
| 14 | checked := passing() |
| 15 | checked.Checks, checked.Eligible = wire.ChecksPassed, true |
| 16 | for name, in := range map[string]Inputs{"unchecked": passing(), "checked": checked} { |
| 17 | if d := Decide(in); d.Class != ClassAct { |
| 18 | t.Fatalf("%s: primary-made work does not act: %+v", name, d) |
| 19 | } |
| 20 | in.MacMade = true |
| 21 | d := Decide(in) |
| 22 | if d.Class != ClassAsk || d.Stance != StanceWait || !slices.Contains(d.Failing(), CritPrimaryMade) { |
| 23 | t.Fatalf("%s: Mac-made work: %+v", name, d) |
| 24 | } |
| 25 | in.AutoMergeCI, in.AutoMergeSensitive = true, true |
| 26 | if d := Decide(in); d.Class != ClassAsk { |
| 27 | t.Fatalf("%s: a standing setting merged Mac-made work: %+v", name, d) |
| 28 | } |
| 29 | in.Person = true |
| 30 | if d := Decide(in); d.Class != ClassAct { |
| 31 | t.Fatalf("%s: the person's Merge: %+v", name, d) |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | |