Ensure daemon autostart lock dir exists (#1037)

Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
Tim Visher
2026-01-12 19:38:13 -05:00
committed by GitHub
parent 7eab16715f
commit 6da965587b
2 changed files with 38 additions and 0 deletions

View File

@@ -127,6 +127,24 @@ func TestDaemonAutostart_AcquireStartLock_CreatesAndCleansStale(t *testing.T) {
}
}
func TestDaemonAutostart_AcquireStartLock_CreatesMissingDir(t *testing.T) {
tmpDir := t.TempDir()
socketPath := filepath.Join(tmpDir, "missing", "bd.sock")
lockPath := socketPath + ".startlock"
if _, err := os.Stat(filepath.Dir(lockPath)); !os.IsNotExist(err) {
t.Fatalf("expected lock dir to be missing before test, got: %v", err)
}
if !acquireStartLock(lockPath, socketPath) {
t.Fatalf("expected acquireStartLock to succeed when directory missing")
}
if _, err := os.Stat(lockPath); err != nil {
t.Fatalf("expected lock file to exist, stat error: %v", err)
}
}
func TestDaemonAutostart_SocketHealthAndReadiness(t *testing.T) {
socketPath, cleanup := startTestRPCServer(t)
defer cleanup()