nomadcode/services/core/internal/config/config_test.go
toki 11490df648 chore: import nomadcode-core into services/core
git-subtree-dir: services/core
git-subtree-mainline: 6f5e3a119f
git-subtree-split: 6fdbc73753
2026-05-21 13:35:20 +09:00

53 lines
1.4 KiB
Go

package config
import "testing"
func TestLoadA2AEdgeURLPrefersEdgeURL(t *testing.T) {
t.Setenv("A2A_EDGE_URL", "http://edge.example/a2a")
t.Setenv("A2A_AGENT_URL", "http://legacy.example/a2a")
cfg := Load()
if cfg.A2AEdgeURL != "http://edge.example/a2a" {
t.Fatalf("A2AEdgeURL: got %q", cfg.A2AEdgeURL)
}
if cfg.A2AAgentURL != "http://legacy.example/a2a" {
t.Fatalf("A2AAgentURL: got %q", cfg.A2AAgentURL)
}
}
func TestLoadA2AEdgeURLFallsBackToLegacyAgentURL(t *testing.T) {
t.Setenv("A2A_AGENT_URL", "http://legacy.example/a2a")
cfg := Load()
if cfg.A2AEdgeURL != "http://legacy.example/a2a" {
t.Fatalf("A2AEdgeURL fallback: got %q", cfg.A2AEdgeURL)
}
if cfg.A2AAgentURL != "http://legacy.example/a2a" {
t.Fatalf("A2AAgentURL: got %q", cfg.A2AAgentURL)
}
}
func TestLoadModelAndA2ADefaults(t *testing.T) {
cfg := Load()
if cfg.ModelBaseURL != "http://192.168.0.91:11434" {
t.Fatalf("ModelBaseURL: got %q", cfg.ModelBaseURL)
}
if cfg.ModelAPIKey != "ollama" {
t.Fatalf("ModelAPIKey: got %q", cfg.ModelAPIKey)
}
if cfg.ModelName != "qwen3.6:35b-a3b-bf16" {
t.Fatalf("ModelName: got %q", cfg.ModelName)
}
if cfg.ModelContextSize != 262144 {
t.Fatalf("ModelContextSize: got %d", cfg.ModelContextSize)
}
if cfg.ModelTimeoutSec != 300 {
t.Fatalf("ModelTimeoutSec: got %d", cfg.ModelTimeoutSec)
}
if cfg.A2ATimeoutSec != 300 {
t.Fatalf("A2ATimeoutSec: got %d", cfg.A2ATimeoutSec)
}
}