Fix Windows CI test failures

Two Windows-specific test failures:

1. TestNewSQLiteStorage - File locking on temp cleanup
   - Windows couldn't delete temp database file because connection was still open
   - Added defer store.Close() to properly cleanup the database connection
   - Without this, Windows file locking prevents TempDir cleanup

2. TestFindAllDatabases - Unexpected nil slice return
   - FindAllDatabases could return nil instead of empty slice when os.Getwd() fails
   - Changed from var databases to explicit empty slice initialization
   - Ensures function always returns non-nil slice, matching test expectations

Both issues are more pronounced on Windows due to stricter file locking
and different filesystem behavior.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-23 23:01:55 -08:00
parent e5bb6ed6dc
commit 153f724e95
2 changed files with 2 additions and 1 deletions

View File

@@ -345,7 +345,7 @@ func findDatabaseInTree() string {
// Returns a slice of DatabaseInfo for each database found, starting from the
// closest to CWD (most relevant) to the furthest (least relevant).
func FindAllDatabases() []DatabaseInfo {
var databases []DatabaseInfo
databases := []DatabaseInfo{} // Initialize to empty slice, never return nil
seen := make(map[string]bool) // Track canonical paths to avoid duplicates
dir, err := os.Getwd()