Persist build extra_files for Build Manager history, print dashboard login on every start, add libp2p for Mesh P2P forge, defer WebSocket until login, and split devrun.bat from LAUNCH.bat with USB deck auto-detection.
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package api
|
|
|
|
import "testing"
|
|
|
|
func TestAgentConfigPoolHostOrDefault(t *testing.T) {
|
|
t.Run("empty uses fallback", func(t *testing.T) {
|
|
cfg := AgentForgeConfig{}
|
|
if got := cfg.poolHostOrDefault("fallback.host"); got != "fallback.host" {
|
|
t.Fatalf("got %q, want fallback.host", got)
|
|
}
|
|
})
|
|
t.Run("explicit host wins", func(t *testing.T) {
|
|
cfg := AgentForgeConfig{PoolHost: "pool.example.com"}
|
|
if got := cfg.poolHostOrDefault("fallback"); got != "pool.example.com" {
|
|
t.Fatalf("got %q, want pool.example.com", got)
|
|
}
|
|
})
|
|
}
|
|
|
|
func TestAgentConfigPoolPortOrDefault(t *testing.T) {
|
|
t.Run("zero uses fallback", func(t *testing.T) {
|
|
cfg := AgentForgeConfig{}
|
|
if got := cfg.poolPortOrDefault(3333); got != 3333 {
|
|
t.Fatalf("got %d, want 3333", got)
|
|
}
|
|
})
|
|
t.Run("negative uses fallback", func(t *testing.T) {
|
|
cfg := AgentForgeConfig{PoolPort: -1}
|
|
if got := cfg.poolPortOrDefault(3333); got != 3333 {
|
|
t.Fatalf("got %d, want 3333", got)
|
|
}
|
|
})
|
|
t.Run("explicit port wins", func(t *testing.T) {
|
|
cfg := AgentForgeConfig{PoolPort: 443}
|
|
if got := cfg.poolPortOrDefault(3333); got != 443 {
|
|
t.Fatalf("got %d, want 443", got)
|
|
}
|
|
})
|
|
}
|