fix(test): Complete rootCtx initialization fix for all hanging tests (issue #355)
Problem:
- TestFallbackToDirectModeEnablesFlush hung with database deadlock
- TestIdempotentImportNoTimestampChurn and TestImportMultipleUnchangedIssues also hung
- All three tests call flushToJSONL() or autoImportIfNewer() which require rootCtx
Solution:
Applied the same rootCtx initialization pattern from v0.24.1 (commit 822baa0)
to the remaining hanging tests:
- TestFallbackToDirectModeEnablesFlush in direct_mode_test.go
- TestIdempotentImportNoTimestampChurn in import_idempotent_test.go
- TestImportMultipleUnchangedIssues in import_idempotent_test.go
Results:
- Before: Tests hung for 5+ minutes with database deadlock
- After: All tests pass in ~0.1s each
Fixes #355
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -218,6 +218,14 @@ func strPtr(s string) *string {
|
||||
// TestIdempotentImportNoTimestampChurn verifies that importing unchanged issues
|
||||
// does not update their timestamps (bd-84)
|
||||
func TestIdempotentImportNoTimestampChurn(t *testing.T) {
|
||||
// FIX: Initialize rootCtx for autoImportIfNewer (issue #355)
|
||||
testRootCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
oldRootCtx := rootCtx
|
||||
rootCtx = testRootCtx
|
||||
defer func() { rootCtx = oldRootCtx }()
|
||||
|
||||
// Create temp directory
|
||||
tmpDir, err := os.MkdirTemp("", "bd-test-idempotent-*")
|
||||
if err != nil {
|
||||
@@ -300,6 +308,14 @@ func TestIdempotentImportNoTimestampChurn(t *testing.T) {
|
||||
// TestImportMultipleUnchangedIssues verifies that importing multiple unchanged issues
|
||||
// does not update any of their timestamps (bd-84)
|
||||
func TestImportMultipleUnchangedIssues(t *testing.T) {
|
||||
// FIX: Initialize rootCtx for autoImportIfNewer (issue #355)
|
||||
testRootCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
oldRootCtx := rootCtx
|
||||
rootCtx = testRootCtx
|
||||
defer func() { rootCtx = oldRootCtx }()
|
||||
|
||||
// Create temp directory
|
||||
tmpDir, err := os.MkdirTemp("", "bd-test-changed-*")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user