Files
distribution/registry/proxy/proxyregistry_test.go
Joonas Bergius 021b69d5a6 fix: nil-check scheduler in proxyingRegistry.Close()
When proxy TTL is set to 0, `NewRegistryPullThroughCache`
skips creating a `TTLExpirationScheduler`. When `Close()`
calls `pr.scheduler.Stop()`, it causes causing a nil pointer
dereference panic.

Signed-off-by: Joonas Bergius <joonas@defenseunicorns.com>
2026-03-01 19:59:20 -06:00

18 lines
314 B
Go

package proxy
import (
"testing"
)
func TestProxyingRegistryCloseWithoutScheduler(t *testing.T) {
pr := &proxyingRegistry{
scheduler: nil,
}
// verify that `Close()` does not panic when the scheduler is nil
err := pr.Close()
if err != nil {
t.Fatalf("Close() returned unexpected error: %v", err)
}
}