mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-10-12 04:04:26 +00:00
- 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)
31 lines
1.1 KiB
Go
31 lines
1.1 KiB
Go
package cache
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
// TestCacheClose_NilStopCleanupNoPanic guards the R149 fix in Close():
|
|
// stopCleanup is only allocated when EnableAutoCleanup && CleanupInterval > 0,
|
|
// but Close() previously closed it whenever EnableAutoCleanup was set. A
|
|
// cache built with EnableAutoCleanup=true and CleanupInterval left at its
|
|
// zero value therefore called close(nil) and panicked during shutdown.
|
|
func TestCacheClose_NilStopCleanupNoPanic(t *testing.T) {
|
|
c := New(Config{EnableAutoCleanup: true}) // CleanupInterval defaults to 0
|
|
if err := c.Close(); err != nil {
|
|
t.Fatalf("Close() with CleanupInterval=0 must not panic and return nil, got: %v", err)
|
|
}
|
|
}
|
|
|
|
// TestCacheClose_WithCleanupIntervalClosesOnce ensures the normal path
|
|
// (cleanup started) still closes cleanly exactly once.
|
|
func TestCacheClose_WithCleanupIntervalClosesOnce(t *testing.T) {
|
|
c := New(Config{EnableAutoCleanup: true, CleanupInterval: time.Minute})
|
|
if err := c.Close(); err != nil {
|
|
t.Fatalf("Close() with a started cleanup goroutine must succeed, got: %v", err)
|
|
}
|
|
if err := c.Close(); err == nil {
|
|
t.Fatal("second Close() must report already-closed")
|
|
}
|
|
}
|