fix(cache): harden cache backends, resilience, recovery, and transports

- RESP -ERR no longer closes healthy conn / aborts batch; global cap replacement-aware
- global health-check pass serialized (latent data race); MemoryMonitor via ResourceManager
- token-exchange retry, open-circuit rejections counted as failures
- TLS-posture matching transport reuse (no silent InsecureSkipVerify handoff)
This commit is contained in:
2026-08-14 16:16:51 +01:00
parent 8640451877
commit 4d23d618f5
49 changed files with 2318 additions and 181 deletions
+25
View File
@@ -0,0 +1,25 @@
package recovery
import (
"testing"
"time"
)
// TestRetryExecutor_HighRandomizationNoNegativeDelay guards the R150 fix in
// RetryExecutor.calculateDelay: with RandomizationFactor > 1 the raw
// minDelay = delay*(1-RF) is negative, letting time.After(negative)
// fire immediately and defeating backoff. Delays must be clamped to
// >= 0.
func TestRetryExecutor_HighRandomizationNoNegativeDelay(t *testing.T) {
exec := NewRetryExecutor(RetryConfig{
InitialDelay: 100 * time.Millisecond,
MaxDelay: 2 * time.Second,
Multiplier: 2.0,
RandomizationFactor: 2.5, // > 1: un-fixed code yields negative delays
}, &mockLogger{})
for attempt := 1; attempt <= 2000; attempt++ {
if d := exec.calculateDelay(attempt); d < 0 {
t.Fatalf("attempt %d produced negative delay %v", attempt, d)
}
}
}