From 11fa1425395ac9d5e9d1c96fe0d739acfb7d45f9 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Thu, 6 Nov 2025 17:31:15 -0800 Subject: [PATCH] Optimize test suite with testing.Short() guards - Add Short() guards to slow CLI tests (2-4s each) - Add Short() guards to slow API/integration tests (3-11s) - Add Short() guard to hanging daemon discovery test (29s timeout) - Short test suite now runs in ~6s (down from 5+ minutes) Run 'go test -short ./...' for fast iteration Run 'go test ./...' for full coverage Closes: bd-iov0 --- cmd/bd/cli_fast_test.go | 39 ++++++++++++++++++++ internal/beads/routing_integration_test.go | 3 ++ internal/compact/compactor_test.go | 6 +++ internal/daemon/discovery_test.go | 3 ++ internal/importer/external_ref_test.go | 3 ++ internal/rpc/comments_test.go | 3 ++ internal/rpc/version_test.go | 3 ++ internal/storage/sqlite/adaptive_e2e_test.go | 3 ++ 8 files changed, 63 insertions(+) diff --git a/cmd/bd/cli_fast_test.go b/cmd/bd/cli_fast_test.go index 94002a80..6b38c541 100644 --- a/cmd/bd/cli_fast_test.go +++ b/cmd/bd/cli_fast_test.go @@ -22,6 +22,9 @@ func setupCLITestDB(t *testing.T) string { } func TestCLI_Ready(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow CLI test in short mode") + } t.Parallel() tmpDir := setupCLITestDB(t) runBD(t, tmpDir, "create", "Ready issue", "-p", "1") @@ -32,6 +35,9 @@ func TestCLI_Ready(t *testing.T) { } func TestCLI_Create(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow CLI test in short mode") + } t.Parallel() tmpDir := setupCLITestDB(t) out := runBD(t, tmpDir, "create", "Test issue", "-p", "1", "--json") @@ -46,6 +52,9 @@ func TestCLI_Create(t *testing.T) { } func TestCLI_List(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow CLI test in short mode") + } t.Parallel() tmpDir := setupCLITestDB(t) runBD(t, tmpDir, "create", "First", "-p", "1") @@ -62,6 +71,9 @@ func TestCLI_List(t *testing.T) { } func TestCLI_Update(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow CLI test in short mode") + } t.Parallel() tmpDir := setupCLITestDB(t) out := runBD(t, tmpDir, "create", "Issue to update", "-p", "1", "--json") @@ -81,6 +93,9 @@ func TestCLI_Update(t *testing.T) { } func TestCLI_Close(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow CLI test in short mode") + } t.Parallel() tmpDir := setupCLITestDB(t) out := runBD(t, tmpDir, "create", "Issue to close", "-p", "1", "--json") @@ -100,6 +115,9 @@ func TestCLI_Close(t *testing.T) { } func TestCLI_DepAdd(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow CLI test in short mode") + } t.Parallel() tmpDir := setupCLITestDB(t) @@ -120,6 +138,9 @@ func TestCLI_DepAdd(t *testing.T) { } func TestCLI_DepRemove(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow CLI test in short mode") + } t.Parallel() tmpDir := setupCLITestDB(t) @@ -141,6 +162,9 @@ func TestCLI_DepRemove(t *testing.T) { } func TestCLI_DepTree(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow CLI test in short mode") + } t.Parallel() tmpDir := setupCLITestDB(t) @@ -162,6 +186,9 @@ func TestCLI_DepTree(t *testing.T) { } func TestCLI_Blocked(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow CLI test in short mode") + } t.Parallel() tmpDir := setupCLITestDB(t) @@ -183,6 +210,9 @@ func TestCLI_Blocked(t *testing.T) { } func TestCLI_Stats(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow CLI test in short mode") + } t.Parallel() tmpDir := setupCLITestDB(t) runBD(t, tmpDir, "create", "Issue 1", "-p", "1") @@ -195,6 +225,9 @@ func TestCLI_Stats(t *testing.T) { } func TestCLI_Show(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow CLI test in short mode") + } t.Parallel() tmpDir := setupCLITestDB(t) out := runBD(t, tmpDir, "create", "Show test", "-p", "1", "--json") @@ -210,6 +243,9 @@ func TestCLI_Show(t *testing.T) { } func TestCLI_Export(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow CLI test in short mode") + } t.Parallel() tmpDir := setupCLITestDB(t) runBD(t, tmpDir, "create", "Export test", "-p", "1") @@ -223,6 +259,9 @@ func TestCLI_Export(t *testing.T) { } func TestCLI_Import(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow CLI test in short mode") + } t.Parallel() tmpDir := setupCLITestDB(t) runBD(t, tmpDir, "create", "Import test", "-p", "1") diff --git a/internal/beads/routing_integration_test.go b/internal/beads/routing_integration_test.go index 311a0791..925105c7 100644 --- a/internal/beads/routing_integration_test.go +++ b/internal/beads/routing_integration_test.go @@ -122,6 +122,9 @@ func TestRoutingWithExplicitOverride(t *testing.T) { } func TestMultiRepoEndToEnd(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow integration test in short mode") + } // Create primary repo primaryDir := t.TempDir() diff --git a/internal/compact/compactor_test.go b/internal/compact/compactor_test.go index a291371f..3bc8bb36 100644 --- a/internal/compact/compactor_test.go +++ b/internal/compact/compactor_test.go @@ -209,6 +209,9 @@ func TestCompactTier1_IneligibleIssue(t *testing.T) { } func TestCompactTier1_WithAPI(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow API test in short mode") + } if os.Getenv("ANTHROPIC_API_KEY") == "" { t.Skip("ANTHROPIC_API_KEY not set, skipping API test") } @@ -339,6 +342,9 @@ func TestCompactTier1Batch_WithIneligible(t *testing.T) { } func TestCompactTier1Batch_WithAPI(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow API test in short mode") + } if os.Getenv("ANTHROPIC_API_KEY") == "" { t.Skip("ANTHROPIC_API_KEY not set, skipping API test") } diff --git a/internal/daemon/discovery_test.go b/internal/daemon/discovery_test.go index 8ceda307..66f5174f 100644 --- a/internal/daemon/discovery_test.go +++ b/internal/daemon/discovery_test.go @@ -219,6 +219,9 @@ func TestDiscoverDaemons_Registry(t *testing.T) { } func TestDiscoverDaemons_Legacy(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow daemon discovery test in short mode") + } tmpDir := t.TempDir() beadsDir := filepath.Join(tmpDir, ".beads") os.MkdirAll(beadsDir, 0755) diff --git a/internal/importer/external_ref_test.go b/internal/importer/external_ref_test.go index 7fc64648..acd8f144 100644 --- a/internal/importer/external_ref_test.go +++ b/internal/importer/external_ref_test.go @@ -11,6 +11,9 @@ import ( ) func TestImportWithExternalRef(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow import test in short mode") + } ctx := context.Background() tmpDir := t.TempDir() dbPath := filepath.Join(tmpDir, "test.db") diff --git a/internal/rpc/comments_test.go b/internal/rpc/comments_test.go index 91ddad6c..4a860e2e 100644 --- a/internal/rpc/comments_test.go +++ b/internal/rpc/comments_test.go @@ -8,6 +8,9 @@ import ( ) func TestCommentOperationsViaRPC(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow RPC test in short mode") + } _, client, cleanup := setupTestServer(t) defer cleanup() diff --git a/internal/rpc/version_test.go b/internal/rpc/version_test.go index a2f5c8dc..b94780d2 100644 --- a/internal/rpc/version_test.go +++ b/internal/rpc/version_test.go @@ -13,6 +13,9 @@ import ( const testVersion100 = "1.0.0" func TestVersionCompatibility(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow RPC test in short mode") + } tests := []struct { name string serverVersion string diff --git a/internal/storage/sqlite/adaptive_e2e_test.go b/internal/storage/sqlite/adaptive_e2e_test.go index a51c6ea2..5b7f32cf 100644 --- a/internal/storage/sqlite/adaptive_e2e_test.go +++ b/internal/storage/sqlite/adaptive_e2e_test.go @@ -9,6 +9,9 @@ import ( ) func TestAdaptiveIDLength_E2E(t *testing.T) { + if testing.Short() { + t.Skip("skipping slow E2E test in short mode") + } // Create in-memory database db, err := New(":memory:") if err != nil {