(t *testing.T)
| 62 | }) |
| 63 | } |
| 64 | |
| 65 | func TestCacheProxyConnectTimeout(t *testing.T) { |
| 66 | t.Run("default is documented and bounded", func(t *testing.T) { |
| 67 | t.Setenv("DUCKGRES_CACHE_PROXY_CONNECT_TIMEOUT", "") |
| 68 | if got := cacheProxyConnectTimeout(); got != 5*time.Second { |
| 69 | t.Fatalf("default timeout = %s, want 5s", got) |
| 70 | } |
| 71 | }) |
| 72 | t.Run("uses explicit duration", func(t *testing.T) { |
| 73 | t.Setenv("DUCKGRES_CACHE_PROXY_CONNECT_TIMEOUT", "750ms") |
| 74 | if got := cacheProxyConnectTimeout(); got != 750*time.Millisecond { |
| 75 | t.Fatalf("timeout = %s, want 750ms", got) |
| 76 | } |
| 77 | }) |
| 78 | t.Run("invalid value fails safely to default", func(t *testing.T) { |
| 79 | t.Setenv("DUCKGRES_CACHE_PROXY_CONNECT_TIMEOUT", "0s") |
| 80 | if got := cacheProxyConnectTimeout(); got != defaultCacheProxyConnectTimeout { |
| 81 | t.Fatalf("timeout = %s, want default %s", got, defaultCacheProxyConnectTimeout) |
nothing calls this directly
no test coverage detected