返回 DeepSeek-Reasonix
helper_entry_test.go
根目录 / internal / skill / skillwatch / helper_entry_test.go
1 package skillwatch
2
3 import (
4 "io"
5 "os"
6 "path/filepath"
7 "testing"
8 )
9
10 // The helper backend re-executes os.Executable(). Windows always takes that
11 // path, so a host binary that does not serve the helper entry degrades every
12 // root to scan fallback while repeatedly spawning and killing children. Force
13 // the same default command here so the missing entry fails on every platform
14 // instead of only on Windows CI.
15 func TestDefaultHelperCommandServesTheRealBinaryEntry(t *testing.T) {
16 dir := t.TempDir()
17 svc := NewService(Options{Stderr: io.Discard, ForceHelper: true})
18 defer svc.Close()
19
20 svc.Subscribe(dir, 2, countingScope, flatHash, func(string) {})
21 waitFor(t, "helper registration through the re-executed binary", func() bool {
22 return svc.Diagnostics().PhysicalWatches == 1
23 })
24
25 if err := os.WriteFile(filepath.Join(dir, "SKILL.md"), []byte("---\nname: x\n---\nbody"), 0o644); err != nil {
26 t.Fatal(err)
27 }
28 waitFor(t, "helper event delivery", func() bool {
29 return svc.Diagnostics().EventsReceived >= 1
30 })
31 }
32
32 lines GO