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
54 lines
1.5 KiB
Go
54 lines
1.5 KiB
Go
package agentcontext
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestResolveConfigUsesExplicitRoomID(t *testing.T) {
|
|
cfg, err := ResolveConfig(ConfigInput{RoomID: "room-1", CWD: "/workspace/project"})
|
|
if err != nil {
|
|
t.Fatalf("ResolveConfig() error = %v", err)
|
|
}
|
|
if cfg.RoomID != "room-1" || cfg.CWD != "/workspace/project" {
|
|
t.Fatalf("unexpected config: %#v", cfg)
|
|
}
|
|
}
|
|
|
|
func TestResolveConfigReadsAgentContextConfig(t *testing.T) {
|
|
t.Setenv("TUTTI_WORKSPACE_ID", "")
|
|
dir := t.TempDir()
|
|
path := filepath.Join(dir, "agent-context.json")
|
|
if err := os.WriteFile(path, []byte(`{
|
|
"schema_version": 1,
|
|
"room_id": "room-from-config",
|
|
"workspace_id": "runtime-ws-1",
|
|
"service_group": "agent-context",
|
|
"endpoint": {"transport":"unix"}
|
|
}`), 0o600); err != nil {
|
|
t.Fatalf("write config: %v", err)
|
|
}
|
|
t.Setenv("TUTTI_AGENT_CONTEXT_CONFIG", path)
|
|
|
|
cfg, err := ResolveConfig(ConfigInput{})
|
|
if err != nil {
|
|
t.Fatalf("ResolveConfig() error = %v", err)
|
|
}
|
|
if cfg.RoomID != "room-from-config" || cfg.WorkspaceID != "runtime-ws-1" || cfg.Endpoint.Transport != "unix" {
|
|
t.Fatalf("unexpected config: %#v", cfg)
|
|
}
|
|
}
|
|
|
|
func TestResolveConfigAllowsCWDOnlyContext(t *testing.T) {
|
|
t.Setenv("TUTTI_AGENT_CONTEXT_CONFIG", "")
|
|
t.Setenv("TUTTI_WORKSPACE_ID", "")
|
|
cfg, err := ResolveConfig(ConfigInput{CWD: "/workspace/runtime-ws-1/project"})
|
|
if err != nil {
|
|
t.Fatalf("ResolveConfig() error = %v", err)
|
|
}
|
|
if cfg.RoomID != "" || cfg.WorkspaceID != "" || cfg.CWD != "/workspace/runtime-ws-1/project" {
|
|
t.Fatalf("config = %#v", cfg)
|
|
}
|
|
}
|