fix: stop store-bound workers and reconcile settled repair fixtures

This commit is contained in:
2026-10-20 16:19:21 +01:00
parent fdf0369ede
commit 4e35da7473
5 changed files with 61 additions and 2 deletions
+32
View File
@@ -0,0 +1,32 @@
package server
import (
"context"
"path/filepath"
"testing"
"time"
"git.a-wan.net/alan/pipelines/internal/pipeline"
)
func TestNotificationWorkerStopsWhenEmbeddedStoreCloses(t *testing.T) {
store, err := pipeline.Open(filepath.Join(t.TempDir(), "workers.db"))
if err != nil {
t.Fatal(err)
}
r, err := newRunner(context.Background(), store)
if err != nil {
store.Close()
t.Fatal(err)
}
if err := store.Close(); err != nil {
t.Fatal(err)
}
done := make(chan struct{})
go func() { r.schedulerWG.Wait(); close(done) }()
select {
case <-done:
case <-time.After(time.Second):
t.Fatal("notification worker outlived its store")
}
}