Identified and tagged obviously-slow integration tests with `//go:build integration` to exclude them from default test runs. This is step 1 of fixing test performance. The real fix is in bd-1rh: refactoring tests to use shared DB setup instead of creating 279 separate databases. Tagged files: - cmd/bd: 8 files (CLI tests, git ops, performance benchmarks) - internal: 8 files (integration tests, E2E tests) Issues: - bd-1rh: Main issue tracking test performance - bd-c49: Audit all tests and create grouping plan (next step) - bd-y6d: POC refactor of create_test.go 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
132 lines
3.0 KiB
Go
132 lines
3.0 KiB
Go
//go:build integration
|
|
// +build integration
|
|
|
|
package fixtures
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/steveyegge/beads/internal/storage/sqlite"
|
|
"github.com/steveyegge/beads/internal/types"
|
|
)
|
|
|
|
func TestLargeSQLite(t *testing.T) {
|
|
tmpDB := t.TempDir() + "/test.db"
|
|
store, err := sqlite.New(tmpDB)
|
|
if err != nil {
|
|
t.Fatalf("Failed to create storage: %v", err)
|
|
}
|
|
defer store.Close()
|
|
|
|
ctx := context.Background()
|
|
|
|
// Initialize database with prefix
|
|
if err := store.SetConfig(ctx, "issue_prefix", "bd-"); err != nil {
|
|
t.Fatalf("Failed to set issue_prefix: %v", err)
|
|
}
|
|
|
|
if err := LargeSQLite(ctx, store); err != nil {
|
|
t.Fatalf("LargeSQLite failed: %v", err)
|
|
}
|
|
|
|
// Verify issue count
|
|
allIssues, err := store.SearchIssues(ctx, "", types.IssueFilter{})
|
|
if err != nil {
|
|
t.Fatalf("Failed to search issues: %v", err)
|
|
}
|
|
|
|
if len(allIssues) != 10000 {
|
|
t.Errorf("Expected 10000 issues, got %d", len(allIssues))
|
|
}
|
|
|
|
// Verify we have epics, features, and tasks
|
|
var epics, features, tasks int
|
|
for _, issue := range allIssues {
|
|
switch issue.IssueType {
|
|
case types.TypeEpic:
|
|
epics++
|
|
case types.TypeFeature:
|
|
features++
|
|
case types.TypeTask:
|
|
tasks++
|
|
}
|
|
}
|
|
|
|
if epics == 0 || features == 0 || tasks == 0 {
|
|
t.Errorf("Missing issue types: epics=%d, features=%d, tasks=%d", epics, features, tasks)
|
|
}
|
|
|
|
t.Logf("Created %d epics, %d features, %d tasks", epics, features, tasks)
|
|
}
|
|
|
|
func TestXLargeSQLite(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("Skipping XLarge test in short mode")
|
|
}
|
|
|
|
tmpDB := t.TempDir() + "/test.db"
|
|
store, err := sqlite.New(tmpDB)
|
|
if err != nil {
|
|
t.Fatalf("Failed to create storage: %v", err)
|
|
}
|
|
defer store.Close()
|
|
|
|
ctx := context.Background()
|
|
|
|
// Initialize database with prefix
|
|
if err := store.SetConfig(ctx, "issue_prefix", "bd-"); err != nil {
|
|
t.Fatalf("Failed to set issue_prefix: %v", err)
|
|
}
|
|
|
|
if err := XLargeSQLite(ctx, store); err != nil {
|
|
t.Fatalf("XLargeSQLite failed: %v", err)
|
|
}
|
|
|
|
// Verify issue count
|
|
allIssues, err := store.SearchIssues(ctx, "", types.IssueFilter{})
|
|
if err != nil {
|
|
t.Fatalf("Failed to search issues: %v", err)
|
|
}
|
|
|
|
if len(allIssues) != 20000 {
|
|
t.Errorf("Expected 20000 issues, got %d", len(allIssues))
|
|
}
|
|
}
|
|
|
|
func TestLargeFromJSONL(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("Skipping JSONL test in short mode")
|
|
}
|
|
|
|
tmpDB := t.TempDir() + "/test.db"
|
|
store, err := sqlite.New(tmpDB)
|
|
if err != nil {
|
|
t.Fatalf("Failed to create storage: %v", err)
|
|
}
|
|
defer store.Close()
|
|
|
|
ctx := context.Background()
|
|
|
|
// Initialize database with prefix
|
|
if err := store.SetConfig(ctx, "issue_prefix", "bd-"); err != nil {
|
|
t.Fatalf("Failed to set issue_prefix: %v", err)
|
|
}
|
|
|
|
tempDir := t.TempDir()
|
|
|
|
if err := LargeFromJSONL(ctx, store, tempDir); err != nil {
|
|
t.Fatalf("LargeFromJSONL failed: %v", err)
|
|
}
|
|
|
|
// Verify issue count
|
|
allIssues, err := store.SearchIssues(ctx, "", types.IssueFilter{})
|
|
if err != nil {
|
|
t.Fatalf("Failed to search issues: %v", err)
|
|
}
|
|
|
|
if len(allIssues) != 10000 {
|
|
t.Errorf("Expected 10000 issues, got %d", len(allIssues))
|
|
}
|
|
}
|