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
This commit is contained in:
parent
5fff4edcb6
commit
11fa142539
8 changed files with 63 additions and 0 deletions
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue