(t *testing.T)
| 120 | func TestResolveEffectiveConfigWorkerQueueTimeoutDefault(t *testing.T) { |
| 121 | resolved := configresolve.ResolveEffective(nil, configresolve.CLIInputs{}, envFromMap(nil), nil) |
| 122 | if resolved.WorkerQueueTimeout != 60*time.Second { |
| 123 | t.Fatalf("expected worker queue timeout default 60s, got %s", resolved.WorkerQueueTimeout) |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | func TestResolveEffectiveConfigInvalidEnvValues(t *testing.T) { |
| 128 | enabled := true |
| 129 | fileCfg := &FileConfig{ |
| 130 | ProcessIsolation: true, |
| 131 | IdleTimeout: "45m", |
| 132 | DuckLake: DuckLakeFileConfig{ |
| 133 | S3UseSSL: true, |
| 134 | DisableMetadataThreadLocalCache: &enabled, |
| 135 | }, |
| 136 | } |
| 137 | |
| 138 | env := map[string]string{ |
| 139 | "DUCKGRES_PROCESS_ISOLATION": "not-a-bool", |
| 140 | "DUCKGRES_DUCKLAKE_S3_USE_SSL": "not-a-bool", |
| 141 | "DUCKGRES_DUCKLAKE_DISABLE_METADATA_THREAD_LOCAL_CACHE": "not-a-bool", |
| 142 | "DUCKGRES_IDLE_TIMEOUT": "bad-duration", |
| 143 | } |
| 144 | |
| 145 | var warns []string |
| 146 | resolved := configresolve.ResolveEffective(fileCfg, configresolve.CLIInputs{}, envFromMap(env), func(msg string) { |
| 147 | warns = append(warns, msg) |
| 148 | }) |
| 149 | |
| 150 | if !resolved.Server.ProcessIsolation { |
| 151 | t.Fatalf("invalid env process isolation should not override valid file value") |
| 152 | } |
| 153 | if !resolved.Server.DuckLake.S3UseSSL { |
| 154 | t.Fatalf("invalid env S3_USE_SSL should not override valid file value") |
| 155 | } |
| 156 | if resolved.Server.DuckLake.DisableMetadataThreadLocalCache == nil || !*resolved.Server.DuckLake.DisableMetadataThreadLocalCache { |
| 157 | t.Fatalf("invalid env disable_metadata_thread_local_cache should not override valid file value") |
| 158 | } |
| 159 | if resolved.Server.IdleTimeout != 45*time.Minute { |
| 160 | t.Fatalf("invalid env idle timeout should not override valid file value, got %s", resolved.Server.IdleTimeout) |
| 161 | } |
| 162 | |
| 163 | wantWarnings := []string{ |
| 164 | "Invalid DUCKGRES_PROCESS_ISOLATION", |
| 165 | "Invalid DUCKGRES_DUCKLAKE_S3_USE_SSL", |
| 166 | "Invalid DUCKGRES_DUCKLAKE_DISABLE_METADATA_THREAD_LOCAL_CACHE", |
| 167 | "Invalid DUCKGRES_IDLE_TIMEOUT duration", |
| 168 | } |
| 169 | for _, w := range wantWarnings { |
| 170 | found := false |
| 171 | for _, got := range warns { |
| 172 | if strings.Contains(got, w) { |
| 173 | found = true |
| 174 | break |
| 175 | } |
| 176 | } |
| 177 | if !found { |
| 178 | t.Fatalf("expected warning containing %q, warnings: %v", w, warns) |
| 179 | } |
nothing calls this directly
no test coverage detected