Files
archie/cmd/archied/store_wiring_test.go
T
sam 61b4b7b0cf refactor(store): replace legacy persistence with SQLite
Task and event persistence now uses a dedicated SQLite sidecar derived from the configured state prefix, matching the independently persisted conversation store. The configured path now means a state-path prefix rather than a database file so fresh SQLite state never attempts to interpret the previous storage format.

Remove the retired implementation and dependency completely, strengthen SQLite migrations and concurrency behavior, restore backend-neutral coverage, and align configuration, operational guidance, UI labels, and deployment documentation with the new storage and host-daemon topology.
2026-08-09 22:27:25 +10:00

41 lines
1.1 KiB
Go

package main
import (
"errors"
"os"
"path/filepath"
"testing"
)
func TestProductionTaskStoreUsesSQLite(t *testing.T) {
configuredPath := filepath.Join(t.TempDir(), "state.db")
path := taskDBPath(configuredPath)
if path == configuredPath {
t.Fatal("task database must use an independent fresh path")
}
st, err := openProductionTaskStore(t.Context(), path)
if err != nil {
t.Fatal(err)
}
if _, err := os.Stat(configuredPath); !errors.Is(err, os.ErrNotExist) {
t.Fatalf("configured anchor path was opened directly: %v", err)
}
inserted, err := st.EnqueueIssue(t.Context(), "acme", "widget", 7, "persisted", "", "", "")
if err != nil || !inserted {
t.Fatalf("EnqueueIssue = (%v, %v), want (true, nil)", inserted, err)
}
if err := st.Close(); err != nil {
t.Fatal(err)
}
st, err = openProductionTaskStore(t.Context(), path)
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = st.Close() })
task, err := st.TaskByIssue(t.Context(), "acme", "widget", 7)
if err != nil || task == nil || task.Title != "persisted" {
t.Fatalf("TaskByIssue after reopen = (%+v, %v)", task, err)
}
}