MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestValidateWorkerBackendConfig

Function TestValidateWorkerBackendConfig

controlplane/validation_test.go:102–151  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

100}
101
102func TestValidateWorkerBackendConfig(t *testing.T) {
103 tests := []struct {
104 name string
105 cfg ControlPlaneConfig
106 wantErr string
107 }{
108 {
109 name: "process backend without config store is allowed",
110 cfg: ControlPlaneConfig{
111 WorkerBackend: "process",
112 },
113 },
114 {
115 name: "remote backend requires config store",
116 cfg: ControlPlaneConfig{
117 WorkerBackend: "remote",
118 },
119 wantErr: "worker_backend=remote requires config_store",
120 },
121 {
122 name: "remote backend with config store is allowed",
123 cfg: ControlPlaneConfig{
124 WorkerBackend: "remote",
125 ConfigStoreConn: "postgres://config-store",
126 },
127 },
128 {
129 name: "config store requires remote backend",
130 cfg: ControlPlaneConfig{
131 WorkerBackend: "process",
132 ConfigStoreConn: "postgres://config-store",
133 },
134 wantErr: "config_store requires worker_backend=remote",
135 },
136 }
137
138 for _, tt := range tests {
139 t.Run(tt.name, func(t *testing.T) {
140 err := validateWorkerBackendConfig(tt.cfg)
141 switch {
142 case tt.wantErr == "" && err != nil:
143 t.Fatalf("expected no error, got %v", err)
144 case tt.wantErr != "" && err == nil:
145 t.Fatalf("expected error containing %q, got nil", tt.wantErr)
146 case tt.wantErr != "" && !strings.Contains(err.Error(), tt.wantErr):
147 t.Fatalf("expected error containing %q, got %v", tt.wantErr, err)
148 }
149 })
150 }
151}
152
153func TestCheckSocketDirWritable(t *testing.T) {
154 // Happy path: writable directory

Callers

nothing calls this directly

Calls 3

RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected