(t *testing.T)
| 15 | } |
| 16 | |
| 17 | func TestValidateRunModeRejectsUnsupportedMode(t *testing.T) { |
| 18 | for _, mode := range []string{"standalone", "control-plane", "duckdb-service", "reshard-runner"} { |
| 19 | if err := validateRunMode(mode); err != nil { |
| 20 | t.Fatalf("expected mode %q to be valid: %v", mode, err) |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | err := validateRunMode("unsupported-mode") |
| 25 | if err == nil { |
| 26 | t.Fatal("expected unsupported mode to be rejected") |
| 27 | } |
| 28 | if !strings.Contains(err.Error(), "unsupported --mode") || |
| 29 | !strings.Contains(err.Error(), "standalone, control-plane, duckdb-service") { |
| 30 | t.Fatalf("unexpected error for unsupported mode: %v", err) |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | func TestResolveEffectiveConfigPrecedence(t *testing.T) { |
| 35 | fileCfg := &FileConfig{ |
| 36 | Host: "file-host", |
| 37 | Port: 5000, |
| 38 | DataDir: "/tmp/file-data", |
| 39 | TLS: TLSConfig{ |
| 40 | Cert: "/tmp/file.crt", |
| 41 | Key: "/tmp/file.key", |
| 42 | }, |
| 43 | ProcessIsolation: true, |
| 44 | IdleTimeout: "1h", |
| 45 | } |
| 46 | |
| 47 | env := map[string]string{ |
| 48 | "DUCKGRES_HOST": "env-host", |
| 49 | "DUCKGRES_PORT": "6000", |
| 50 | "DUCKGRES_DATA_DIR": "/tmp/env-data", |
| 51 | "DUCKGRES_CERT": "/tmp/env.crt", |
| 52 | "DUCKGRES_KEY": "/tmp/env.key", |
| 53 | "DUCKGRES_PROCESS_ISOLATION": "true", |
| 54 | "DUCKGRES_IDLE_TIMEOUT": "2h", |
| 55 | } |
| 56 | |
| 57 | resolved := configresolve.ResolveEffective(fileCfg, configresolve.CLIInputs{ |
| 58 | Set: map[string]bool{ |
| 59 | "host": true, |
| 60 | "port": true, |
| 61 | "data-dir": true, |
| 62 | "cert": true, |
| 63 | "key": true, |
| 64 | "process-isolation": true, |
| 65 | "idle-timeout": true, |
| 66 | }, |
| 67 | Host: "cli-host", |
| 68 | Port: 7000, |
| 69 | DataDir: "/tmp/cli-data", |
| 70 | CertFile: "/tmp/cli.crt", |
| 71 | KeyFile: "/tmp/cli.key", |
| 72 | ProcessIsolation: false, |
| 73 | IdleTimeout: "3h", |
| 74 | }, envFromMap(env), nil) |
nothing calls this directly
no test coverage detected