Files
AetherForge/agent/deploy/lan_seeder_test.go
AetherForge 7b2d41cda8
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Expand P2 test coverage: mining chain, spread lanes, path forge, WS/beacon, E2E onion, file handling
2026-06-07 04:58:55 -07:00

23 lines
723 B
Go

package deploy
import "testing"
func TestNearestLANSeederPrefersSameSubnet(t *testing.T) {
seeders := []LANSeederHint{
{AgentID: "far", IP: "10.0.9.1", LANFallbackURL: "http://10.0.9.1/manifest"},
{AgentID: "near", IP: "192.168.1.50", LANFallbackURL: "http://192.168.1.50/manifest"},
}
got := NearestLANSeeder(seeders, "192.168.1.10")
if got == nil || got.AgentID != "near" {
t.Fatalf("got %+v", got)
}
}
func TestApplyLANSeederToWebRTC(t *testing.T) {
policy := WebRTCMeshPolicy{}
ApplyLANSeederToWebRTC(&policy, &LANSeederHint{AgentID: "seed-1", LANFallbackURL: "http://lan/seed"})
if policy.SeederAgentID != "seed-1" || policy.LANFallbackURL != "http://lan/seed" {
t.Fatalf("policy=%+v", policy)
}
}