mirror of
https://github.com/distribution/distribution.git
synced 2026-07-17 02:00:41 +00:00
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>
18 lines
314 B
Go
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)
|
|
}
|
|
}
|