Исправить замечания ревью: останавливать лестницу только при перегрузке системы, проверять файлы серий до запуска, исправить единицы контроля шума, убрать лишние комментарии

This commit is contained in:
2026-11-04 12:58:00 +03:00
parent baa5995938
commit f5f8040783
8 changed files with 58 additions and 22 deletions
+20
View File
@@ -126,3 +126,23 @@ func TestStepPassesOnlyWithinTheObjective(t *testing.T) {
t.Fatalf("an invalid step must fail: %+v", s)
}
}
// The ladder stops when the system leaves the objective, not when the
// generator alone fell behind: a later step may still be valid and pass.
func TestOnlyTheSystemEndsTheLadder(t *testing.T) {
ok := func(latency, lag time.Duration) sample {
return sample{class: "ok", latency: latency, lag: lag}
}
late := []sample{ok(10*time.Millisecond, 50*time.Millisecond), ok(10*time.Millisecond, 50*time.Millisecond)}
if s := summarize(2, time.Second, late); s.overloaded() {
t.Fatalf("a lagging generator must not end the ladder: %+v", s)
}
slow := []sample{ok(10*time.Millisecond, time.Millisecond), ok(600*time.Millisecond, time.Millisecond)}
if s := summarize(2, time.Second, slow); !s.overloaded() {
t.Fatalf("p99 above 500 ms must end the ladder: %+v", s)
}
failing := []sample{ok(10*time.Millisecond, time.Millisecond), {class: "client_timeout", lag: time.Millisecond}}
if s := summarize(2, time.Second, failing); !s.overloaded() {
t.Fatalf("errors above 1 %% must end the ladder: %+v", s)
}
}