Merge pull request 'Hold a leaf delivery to three minutes in times (hq ADR 0304 decision 4, issue 525)' (#227) from feat/525-leaf-budget-three-minutes into main
This commit was merged in pull request #227.
This commit is contained in:
@@ -205,7 +205,7 @@ func tools(h *Holder, l *listening) []stdio.Tool {
|
||||
}},
|
||||
{Name: seat + "times",
|
||||
Description: "Delivery time (novox/hq ADR 0282): from a merge to every machine of its walk running the build. " +
|
||||
"Each class's budget (a leaf module five minutes, a core module ten), the last days' median and worst, " +
|
||||
"Each class's budget (a leaf module three minutes, a core module ten), the last days' median and worst, " +
|
||||
"how many within and over, the newest delivery of each class, every delivery over its budget with its " +
|
||||
"longest phase, and the delivered ones whose time is not known and why. Given a delivery's id, its time " +
|
||||
"phase by phase: window, queued, word, build, send-first, judgement, send-rest, between-tiers, apply — " +
|
||||
|
||||
@@ -13,8 +13,8 @@ import (
|
||||
// delivery time from its own merge, its class and its phases, and `times` answers the week's median and worst
|
||||
// per class against its budget. Measurement only: nothing here holds, releases or changes a delivery.
|
||||
|
||||
// The budgets by class (ADR 0282 decision 1).
|
||||
var budgets = map[string]time.Duration{"leaf": 5 * time.Minute, "core": 10 * time.Minute}
|
||||
// The budgets by class (ADR 0282 decision 1, the leaf's as ADR 0304 decision 4 changed it).
|
||||
var budgets = map[string]time.Duration{"leaf": 3 * time.Minute, "core": 10 * time.Minute}
|
||||
|
||||
// classes in the order `times` says them.
|
||||
var classes = []string{"leaf", "core"}
|
||||
|
||||
@@ -68,8 +68,8 @@ func TestADeliveryKeepsItsTimeFromItsOwnMerge(t *testing.T) {
|
||||
if d.Time == nil {
|
||||
t.Fatalf("no delivery time kept: %+v", d)
|
||||
}
|
||||
if d.Time.TookMS != (280*time.Second).Milliseconds() || d.Time.Class != "leaf" || d.Time.Over {
|
||||
t.Fatalf("time %dms (want 280000, from its own merge), class %s, over %v", d.Time.TookMS, d.Time.Class, d.Time.Over)
|
||||
if d.Time.TookMS != (280*time.Second).Milliseconds() || d.Time.Class != "leaf" || !d.Time.Over {
|
||||
t.Fatalf("time %dms (want 280000, from its own merge, over a leaf's three minutes), class %s, over %v", d.Time.TookMS, d.Time.Class, d.Time.Over)
|
||||
}
|
||||
var sum int64
|
||||
for _, p := range d.Time.Phases {
|
||||
@@ -133,9 +133,13 @@ func TestADeliveryKeepsItsTimeFromItsOwnMerge(t *testing.T) {
|
||||
t.Fatalf("merged after its walk's end: %+v", dt)
|
||||
}
|
||||
// Exactly its budget is within it.
|
||||
p = phasesOf("leaf", from, ph{"build", 5*time.Minute + 10*time.Second})
|
||||
if dt := timeOf(&Delivery{MergedAt: from.Add(10 * time.Second)}, Walk{ID: "w", Phases: p}); dt.Over || dt.TookMS != 300000 {
|
||||
t.Fatalf("five minutes is within a leaf's budget: %+v", dt)
|
||||
p = phasesOf("leaf", from, ph{"build", 3*time.Minute + 10*time.Second})
|
||||
if dt := timeOf(&Delivery{MergedAt: from.Add(10 * time.Second)}, Walk{ID: "w", Phases: p}); dt.Over || dt.TookMS != 180000 {
|
||||
t.Fatalf("three minutes is within a leaf's budget: %+v", dt)
|
||||
}
|
||||
p = phasesOf("leaf", from, ph{"build", 3*time.Minute + 11*time.Second})
|
||||
if dt := timeOf(&Delivery{MergedAt: from.Add(10 * time.Second)}, Walk{ID: "w", Phases: p}); !dt.Over {
|
||||
t.Fatalf("a second past three minutes is over a leaf's budget: %+v", dt)
|
||||
}
|
||||
// Seen again, unchanged: not written again (issue 326).
|
||||
before := w.store.puts
|
||||
@@ -174,8 +178,8 @@ func TestTimesSaysEachClassAgainstItsBudget(t *testing.T) {
|
||||
return walkedOnce(w, n, "head"+string(rune('a'+n)), "merge"+string(rune('a'+n))+"zzzz",
|
||||
phasesOf("leaf", t0.Add(at), ph{"window", 10 * time.Second}, ph{"judgement", d}))
|
||||
}
|
||||
leaf(1, 2*time.Minute, 0)
|
||||
leaf(2, 4*time.Minute, time.Hour)
|
||||
leaf(1, 1*time.Minute, 0)
|
||||
leaf(2, 2*time.Minute, time.Hour)
|
||||
over := leaf(3, 6*time.Minute, 2*time.Hour)
|
||||
walkedOnce(w, 4, "headcore", "mergekore1", phasesOf("core", t0.Add(3*time.Hour), ph{"judgement", 9 * time.Minute}))
|
||||
w.later(4 * time.Hour)
|
||||
@@ -184,8 +188,8 @@ func TestTimesSaysEachClassAgainstItsBudget(t *testing.T) {
|
||||
t.Fatalf("classes: %+v", a.Classes)
|
||||
}
|
||||
l := a.Classes[0]
|
||||
// Each delivery's time is from its own merge, ten seconds after the walk's: 2m, 4m, 6m.
|
||||
if l.Count != 3 || l.Within != 2 || l.Over != 1 || l.MedianMS != (4*time.Minute).Milliseconds() ||
|
||||
// Each delivery's time is from its own merge, ten seconds after the walk's: 1m, 2m, 6m.
|
||||
if l.Count != 3 || l.Within != 2 || l.Over != 1 || l.MedianMS != (2*time.Minute).Milliseconds() ||
|
||||
l.WorstMS != (6*time.Minute).Milliseconds() || l.WorstID != over {
|
||||
t.Fatalf("leaf: %+v", l)
|
||||
}
|
||||
@@ -198,7 +202,7 @@ func TestTimesSaysEachClassAgainstItsBudget(t *testing.T) {
|
||||
if len(a.Over) != 1 || a.Over[0].ID != over {
|
||||
t.Fatalf("over: %+v", a.Over)
|
||||
}
|
||||
if !strings.Contains(a.Line, "leaf: median 4m0s, worst 6m0s, 2 of 3 within 5m0s") {
|
||||
if !strings.Contains(a.Line, "leaf: median 2m0s, worst 6m0s, 2 of 3 within 3m0s") {
|
||||
t.Fatalf("the line: %s", a.Line)
|
||||
}
|
||||
// Past the window, nothing.
|
||||
|
||||
Reference in New Issue
Block a user