- Add unbounded CLI sessions agent-task with plan and code review logs - Add edge console with tests - Add node run manager for session lifecycle management - Add router and store tests - Update transport session handling - Add runtime proto definitions - Update configurations and packages
85 lines
2.4 KiB
Go
85 lines
2.4 KiB
Go
package config_test
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"iop/packages/config"
|
|
)
|
|
|
|
func TestLoadEdge_ConsoleTimeoutDefault(t *testing.T) {
|
|
dir := t.TempDir()
|
|
f := filepath.Join(dir, "edge.yaml")
|
|
if err := os.WriteFile(f, []byte("server:\n listen: \"0.0.0.0:9090\"\n"), 0o600); err != nil {
|
|
t.Fatalf("write yaml: %v", err)
|
|
}
|
|
|
|
cfg, err := config.LoadEdge(f)
|
|
if err != nil {
|
|
t.Fatalf("load: %v", err)
|
|
}
|
|
if cfg.Console.TimeoutSec != 120 {
|
|
t.Fatalf("expected default timeout_sec=120, got %d", cfg.Console.TimeoutSec)
|
|
}
|
|
if cfg.Console.Adapter != "cli" {
|
|
t.Fatalf("expected default console.adapter=%q, got %q", "cli", cfg.Console.Adapter)
|
|
}
|
|
if cfg.Console.Model != "codex" {
|
|
t.Fatalf("expected default console.model=%q, got %q", "codex", cfg.Console.Model)
|
|
}
|
|
}
|
|
|
|
func TestLoadEdge_ConsoleSessionDefaults(t *testing.T) {
|
|
dir := t.TempDir()
|
|
f := filepath.Join(dir, "edge.yaml")
|
|
if err := os.WriteFile(f, []byte("server:\n listen: \"0.0.0.0:9090\"\n"), 0o600); err != nil {
|
|
t.Fatalf("write yaml: %v", err)
|
|
}
|
|
cfg, err := config.LoadEdge(f)
|
|
if err != nil {
|
|
t.Fatalf("load: %v", err)
|
|
}
|
|
if cfg.Console.SessionID != "default" {
|
|
t.Fatalf("expected default session_id=%q, got %q", "default", cfg.Console.SessionID)
|
|
}
|
|
if cfg.Console.Background {
|
|
t.Fatal("expected default background=false")
|
|
}
|
|
}
|
|
|
|
func TestLoadEdge_ConsoleSessionOverride(t *testing.T) {
|
|
dir := t.TempDir()
|
|
f := filepath.Join(dir, "edge.yaml")
|
|
yaml := "server:\n listen: \"0.0.0.0:9090\"\nconsole:\n session_id: \"worker-1\"\n background: true\n"
|
|
if err := os.WriteFile(f, []byte(yaml), 0o600); err != nil {
|
|
t.Fatalf("write yaml: %v", err)
|
|
}
|
|
cfg, err := config.LoadEdge(f)
|
|
if err != nil {
|
|
t.Fatalf("load: %v", err)
|
|
}
|
|
if cfg.Console.SessionID != "worker-1" {
|
|
t.Fatalf("expected session_id=%q, got %q", "worker-1", cfg.Console.SessionID)
|
|
}
|
|
if !cfg.Console.Background {
|
|
t.Fatal("expected background=true")
|
|
}
|
|
}
|
|
|
|
func TestLoadEdge_ConsoleTimeoutOverride(t *testing.T) {
|
|
dir := t.TempDir()
|
|
f := filepath.Join(dir, "edge.yaml")
|
|
yaml := "server:\n listen: \"0.0.0.0:9090\"\nconsole:\n timeout_sec: 45\n"
|
|
if err := os.WriteFile(f, []byte(yaml), 0o600); err != nil {
|
|
t.Fatalf("write yaml: %v", err)
|
|
}
|
|
|
|
cfg, err := config.LoadEdge(f)
|
|
if err != nil {
|
|
t.Fatalf("load: %v", err)
|
|
}
|
|
if cfg.Console.TimeoutSec != 45 {
|
|
t.Fatalf("expected timeout_sec=45, got %d", cfg.Console.TimeoutSec)
|
|
}
|
|
}
|