Fix all test failures from bd-166 (missing issue_prefix)

Completed bd-167: Fixed all tests that failed with 'database not initialized: issue_prefix config is missing' error.

Changes:
- Created test helper functions in 3 locations:
  * cmd/bd/test_helpers_test.go (already existed)
  * internal/rpc/test_helpers.go (new)
  * internal/storage/sqlite/test_helpers.go (new)

- Updated all affected test files to use newTestStore():
  * cmd/bd: comments, export, git_sync, label, list, reopen, direct_mode
  * internal/rpc: rpc_test, version_test
  * internal/storage/sqlite: sqlite_test, underlying_db_test

- Fixed config test: updated flush-debounce default from 5s to 30s

- Removed unused sqlite imports from test files

All tests now passing 

Also:
- Closed bd-167, bd-170 (cleanup of beads-* duplicates)
- Removed corrupt backup files

Amp-Thread-ID: https://ampcode.com/threads/T-4a8c6002-9384-45b6-81f6-2907d1e4c6c2
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-26 22:31:24 -07:00
parent 09e881022e
commit 4ea347e08a
16 changed files with 88 additions and 92 deletions

View File

@@ -1301,6 +1301,11 @@ func TestInMemoryDatabase(t *testing.T) {
}
defer store.Close()
// Set issue_prefix (bd-166)
if err := store.SetConfig(ctx, "issue_prefix", "bd"); err != nil {
t.Fatalf("failed to set issue_prefix: %v", err)
}
// Verify we can create and retrieve an issue
issue := &types.Issue{
Title: "Test in-memory issue",
@@ -1344,6 +1349,11 @@ func TestInMemorySharedCache(t *testing.T) {
}
defer store1.Close()
// Set issue_prefix (bd-166)
if err := store1.SetConfig(ctx, "issue_prefix", "bd"); err != nil {
t.Fatalf("failed to set issue_prefix: %v", err)
}
// Create an issue in the first connection
issue := &types.Issue{
Title: "Shared memory test",