Optimize test suite performance (15-18x speedup)

- Add t.Parallel() to CLI and export/import tests for concurrent execution
- Remove unnecessary 200ms sleep in daemon_autoimport_test (Execute forces sync)
- Reduce filesystem settle wait from 100ms to 50ms on non-Windows
- Optimize debouncer test sleeps (9 reductions, 30-50% faster)

Results:
- cmd/bd: 5+ minutes → 18 seconds
- internal/importer: < 1 second
- Most packages: < 2 seconds

Closes bd-gpe7
This commit is contained in:
Steve Yegge
2025-11-05 10:26:58 -08:00
parent 32849c727a
commit 0fc4da7358
4 changed files with 31 additions and 16 deletions

View File

@@ -133,6 +133,7 @@ func (h *exportImportHelper) validateJSONLines(buf *bytes.Buffer, expectedCount
}
func TestExportImport(t *testing.T) {
t.Parallel()
tmpDir := t.TempDir()
dbPath := filepath.Join(tmpDir, "test.db")
store := newTestStoreWithPrefix(t, dbPath, "test")
@@ -199,6 +200,7 @@ func TestExportImport(t *testing.T) {
}
func TestExportEmpty(t *testing.T) {
t.Parallel()
tmpDir := t.TempDir()
dbPath := filepath.Join(tmpDir, "empty.db")
store := newTestStore(t, dbPath)
@@ -216,6 +218,7 @@ func TestExportEmpty(t *testing.T) {
}
func TestImportInvalidJSON(t *testing.T) {
t.Parallel()
invalidJSON := []string{
`{"id":"test-1"`, // Incomplete JSON
`{"id":"test-1","title":}`, // Invalid syntax
@@ -233,6 +236,7 @@ func TestImportInvalidJSON(t *testing.T) {
}
func TestRoundTrip(t *testing.T) {
t.Parallel()
tmpDir := t.TempDir()
dbPath := filepath.Join(tmpDir, "original.db")
store := newTestStoreWithPrefix(t, dbPath, "test")