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

Function TestDuckLakeCheckpointerStopWaitsForLoop

server/checkpoint_test.go:183–211  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

181}
182
183func TestDuckLakeCheckpointerStopWaitsForLoop(t *testing.T) {
184 db, err := sql.Open("duckdb", ":memory:")
185 if err != nil {
186 t.Fatalf("open duckdb: %v", err)
187 }
188
189 c := &DuckLakeCheckpointer{
190 db: db,
191 interval: time.Hour,
192 done: make(chan struct{}),
193 loopDone: make(chan struct{}),
194 }
195
196 go c.loop()
197
198 // Stop should return promptly without deadlocking.
199 done := make(chan struct{})
200 go func() {
201 c.Stop()
202 close(done)
203 }()
204
205 select {
206 case <-done:
207 // success
208 case <-time.After(5 * time.Second):
209 t.Fatal("Stop() did not return within timeout — possible deadlock")
210 }
211}

Callers

nothing calls this directly

Calls 3

loopMethod · 0.95
StopMethod · 0.95
OpenMethod · 0.45

Tested by

no test coverage detected