跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

windows_controller_test.go

32 行 · 1.1 KB历史下载
1package workbench
2
3import (
4 "os"
5 "path/filepath"
6 "runtime"
7 "testing"
8
9 "github.com/google/uuid"
10 "github.com/sylvinus/agent-vm/internal/guestos"
11)
12
13func TestWindowsControllerCannotTreatUnknownVMAsIdle(t *testing.T) {
14 if runtime.GOOS == "windows" {
15 t.Skip("native Hyper-V state is covered by the opt-in Windows E2E")
16 }
17 profile := t.TempDir()
18 binding := guestos.WindowsProfile{Version: 1, VMID: uuid.New(), GUIUserSID: "S-1-5-21-1-2-3-1001", InstanceDirectory: filepath.Join(profile, "hyperv"), RelayExecutable: filepath.Join(profile, "relay.exe"), PairingFile: filepath.Join(profile, "pairing.bin")}
19 if err := guestos.BindWindowsProfile(profile, binding); err != nil {
20 t.Fatal(err)
21 }
22 legacy := filepath.Join(profile, "state", "lima", "unrelated")
23 if err := os.MkdirAll(legacy, 0700); err != nil {
24 t.Fatal(err)
25 }
26 if err := writePrivate(filepath.Join(legacy, "cage-running.json"), map[string]int{"pid": os.Getpid()}); err != nil {
27 t.Fatal(err)
28 }
29 if _, err := controllerVMOwners(profile); err == nil {
30 t.Fatal("unsupported Hyper-V probe became an idle or unrelated Lima workload")
31 }
32}