Optimize test suite: split integration tests, add -short support
- Split slow importer integration tests into separate file - Add t.Short() guards to 10 slow daemon tests - Document test organization in TEST_OPTIMIZATION.md - Fast tests now run in ~50s vs 3+ minutes - Use 'go test -short ./...' for fast feedback Amp-Thread-ID: https://ampcode.com/threads/T-29ae21ac-749d-43d7-bf0c-2c5f7a06ae76 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -246,15 +246,26 @@ func TestCLI_Import(t *testing.T) {
|
||||
var testBD string
|
||||
|
||||
func init() {
|
||||
// Build bd binary once
|
||||
tmpDir, err := os.MkdirTemp("", "bd-cli-test-*")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// Use existing bd binary from repo root if available, otherwise build once
|
||||
bdBinary := "bd"
|
||||
if runtime.GOOS == "windows" {
|
||||
bdBinary = "bd.exe"
|
||||
}
|
||||
|
||||
// Check if bd binary exists in repo root (../../bd from cmd/bd/)
|
||||
repoRoot := filepath.Join("..", "..")
|
||||
existingBD := filepath.Join(repoRoot, bdBinary)
|
||||
if _, err := os.Stat(existingBD); err == nil {
|
||||
// Use existing binary
|
||||
testBD, _ = filepath.Abs(existingBD)
|
||||
return
|
||||
}
|
||||
|
||||
// Fall back to building once (for CI or fresh checkouts)
|
||||
tmpDir, err := os.MkdirTemp("", "bd-cli-test-*")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
testBD = filepath.Join(tmpDir, bdBinary)
|
||||
cmd := exec.Command("go", "build", "-o", testBD, ".")
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
//go:build integration
|
||||
// +build integration
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
//go:build integration
|
||||
// +build integration
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
//go:build integration
|
||||
// +build integration
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
//go:build integration
|
||||
// +build integration
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
//go:build integration
|
||||
// +build integration
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
//go:build integration
|
||||
// +build integration
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
//go:build integration
|
||||
// +build integration
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -9,6 +9,8 @@ import (
|
||||
"github.com/steveyegge/beads/internal/storage/sqlite"
|
||||
)
|
||||
|
||||
const windowsOS = "windows"
|
||||
|
||||
// newTestStore creates a SQLite store with issue_prefix configured (bd-166)
|
||||
// This prevents "database not initialized" errors in tests
|
||||
func newTestStore(t *testing.T, dbPath string) *sqlite.SQLiteStorage {
|
||||
|
||||
Reference in New Issue
Block a user