gate: a merge held past 30 minutes by another delivery's check is a stalled line naming that check and since when, said as delivery.<id>.stalled (ADR 0548 §4; issue 568 G3)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
sdk "git.novox.be/novox/mesh-sdk/go/delivery"
|
||||
)
|
||||
@@ -85,6 +86,24 @@ func TestOneCheckPerDeliveryAtTheGate(t *testing.T) {
|
||||
d.Ready.HeldSince == nil {
|
||||
t.Fatalf("the merge does not say what it waits for: %+v", d.Ready)
|
||||
}
|
||||
// §4: past 30 minutes the held merge is a stalled line naming the check it waits for and since when.
|
||||
for _, l := range w.h.Stalled() {
|
||||
if l.ID == id {
|
||||
t.Fatalf("a stalled line within the bound: %+v", l)
|
||||
}
|
||||
}
|
||||
w.later(turnBound + time.Minute)
|
||||
w.settleAll()
|
||||
var line *StalledLine
|
||||
for _, l := range w.h.Stalled() {
|
||||
if l.ID == id {
|
||||
line = &l
|
||||
}
|
||||
}
|
||||
if line == nil || line.Bound != "30m0s" || !strings.Contains(line.Says, "waits for the check of g") || !strings.Contains(line.Says, "held since") ||
|
||||
!strings.Contains(line.Says, "checker_status") || !strings.Contains(line.H2, "delivery_hand_now") {
|
||||
t.Fatalf("the stalled line of the held merge = %+v", line)
|
||||
}
|
||||
putCheckerVerdict(w, "pass", headOf(oneRepo, 9, otherHead))
|
||||
w.settleAll()
|
||||
if len(w.forge.merges) != 1 || w.op.count() != 1 {
|
||||
|
||||
@@ -224,6 +224,9 @@ func (h *Holder) nextStall(now time.Time) time.Time {
|
||||
consider(r.RefusedSince.Add(h.answeredRefusalBound(d.Repository)))
|
||||
consider(r.RefusedSince.Add(outOfDateFor))
|
||||
}
|
||||
if r.HeldSince != nil {
|
||||
consider(r.HeldSince.Add(turnBound))
|
||||
}
|
||||
}
|
||||
return next
|
||||
}
|
||||
|
||||
@@ -218,6 +218,7 @@ func (h *Holder) Stalled() []StalledLine {
|
||||
}
|
||||
out = append(out, h.withChecks(h.uncheckedLines(now))...)
|
||||
out = append(out, h.readyLines(now)...)
|
||||
out = append(out, h.turnLines(now)...) // an approved merge held past its bound by another delivery's check (ADR 0548 §4)
|
||||
out = append(out, h.groupLines(now)...)
|
||||
sort.Slice(out, func(i, j int) bool { return out[i].ID < out[j].ID })
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user