Files
beads/cmd/bd/daemon_parent_test.go
Steve Yegge 82902432f5 test: Tag 16 slow integration tests with build tags
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>
2025-11-21 14:40:22 -05:00

49 lines
1.2 KiB
Go

//go:build integration
// +build integration
package main
import (
"os/exec"
"path/filepath"
"testing"
)
// TestDaemonExitsWhenParentDies verifies that the daemon exits when its parent process dies
func TestDaemonExitsWhenParentDies(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
t.Skip("Manual test - requires daemon to be run externally")
// This is a manual test scenario:
// 1. Start a shell process that spawns the daemon
// 2. Verify daemon tracks parent PID
// 3. Kill the shell process
// 4. Verify daemon exits within 10-15 seconds
//
// To test manually:
// $ sh -c 'bd daemon --interval 5s & sleep 100' &
// $ SHELL_PID=$!
// $ # Check daemon.lock has parent_pid set to SHELL_PID
// $ kill $SHELL_PID
// $ # Daemon should exit within 10-15 seconds
}
func mustAbs(t *testing.T, path string) string {
abs, err := filepath.Abs(path)
if err != nil {
t.Fatalf("Failed to get absolute path: %v", err)
}
return abs
}
func runGitCmd(t *testing.T, dir string, args ...string) {
cmd := exec.Command("git", args...)
cmd.Dir = dir
if err := cmd.Run(); err != nil {
t.Fatalf("git %v failed: %v", args, err)
}
}