Лабораторная 7

This commit is contained in:
MacBook
2026-11-24 12:20:21 +03:00
parent 20afc2c790
commit b962fa0d5d
99 changed files with 11329 additions and 107 deletions
+22
View File
@@ -0,0 +1,22 @@
package pipeline
import (
"testing"
"time"
)
func TestRetryDelayBounds(t *testing.T) {
for attempt := 1; attempt <= 20; attempt++ {
bounded := attempt
if bounded > 6 {
bounded = 6
}
base := time.Second * time.Duration(1<<uint(bounded-1))
for i := 0; i < 100; i++ {
got := RetryDelay(attempt)
if got < base || got > base+base/2 {
t.Fatalf("attempt %d: delay %s outside [%s,%s]", attempt, got, base, base+base/2)
}
}
}
}