Files
agent-radar 2ed3415fb7
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:17:27 +08:00

53 lines
1.5 KiB
Go

//go:build windows
package computer
import (
"context"
"errors"
"strings"
"testing"
)
func TestWaitForWindowsDriverDaemonRetriesUntilReady(t *testing.T) {
probes := 0
err := waitForWindowsDriverDaemon(context.Background(), nil, nil, func(context.Context) bool {
probes++
return probes == 2
})
if err != nil {
t.Fatalf("waitForWindowsDriverDaemon() error = %v", err)
}
if probes != 2 {
t.Fatalf("probe count = %d, want 2", probes)
}
}
func TestWaitForWindowsDriverDaemonReportsEarlyExit(t *testing.T) {
processDone := make(chan error, 1)
processDone <- errors.New("exit status 1")
diagnostics := &computerDaemonDiagnosticTail{}
_, _ = diagnostics.Write([]byte("Error: token sk-secret: address already in use"))
err := waitForWindowsDriverDaemon(context.Background(), processDone, diagnostics, func(context.Context) bool {
return false
})
if err == nil || !strings.Contains(err.Error(), "exited before becoming ready (listen address already in use): exit status 1") {
t.Fatalf("waitForWindowsDriverDaemon() error = %v", err)
}
if strings.Contains(err.Error(), "sk-secret") {
t.Fatalf("waitForWindowsDriverDaemon() error leaked stderr: %v", err)
}
}
func TestComputerDaemonDiagnosticTailClassifiesWithoutLeakingStderr(t *testing.T) {
diagnostics := &computerDaemonDiagnosticTail{}
_, _ = diagnostics.Write([]byte("permission denied for user@example.com at C:\\Users\\private"))
if got, want := diagnostics.String(), "permission denied"; got != want {
t.Fatalf("diagnostics.String() = %q, want %q", got, want)
}
}