跳到主要内容

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

浏览文件

guest_system_start_test.go

35 行 · 1.3 KB历史下载
1package workbench
2
3import (
4 "github.com/google/uuid"
5 "github.com/sylvinus/agent-vm/internal/guestos"
6 "net/http"
7 "strings"
8 "testing"
9)
10
11func TestUnsupportedGuestSystemCannotStartDebian(t *testing.T) {
12 s := testServer(t)
13 for _, system := range []string{"macos", "windows-11", "debian-12", "ubuntu-22.04", "ubuntu-24.04", "unknown"} {
14 response := request(s, http.MethodPost, "/api/start", s.origin, `{"guest_system":"`+system+`"}`, true)
15 if response.Code != http.StatusConflict || s.jobs.snapshot().ID != "" {
16 t.Fatalf("%s: got %d, job %v", system, response.Code, s.jobs.snapshot())
17 }
18 }
19}
20
21func TestIncompleteInstallationPreventsImplicitLinuxStart(t *testing.T) {
22 s := testServer(t)
23 if err := guestos.SaveInstallation(s.profile, guestos.Installation{Version: 1, System: guestos.MacOS, ID: uuid.New()}); err != nil {
24 t.Fatal(err)
25 }
26 for _, body := range []string{"{}", `{"guest_system":"debian-13"}`} {
27 w := request(s, "POST", "/api/start", s.origin, body, true)
28 if w.Code != http.StatusConflict || s.jobs.snapshot().ID != "" {
29 t.Fatalf("created a Linux job from pending macOS (%s): %d", body, w.Code)
30 }
31 }
32 if err := s.startEnvironment(false); err == nil || !strings.Contains(err.Error(), "原生客户机") {
33 t.Fatalf("indirect Linux start: %v", err)
34 }
35}