Expand P2 test coverage: mining chain, spread lanes, path forge, WS/beacon, E2E onion, file handling
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
This commit is contained in:
22
agent/deploy/lan_seeder_test.go
Normal file
22
agent/deploy/lan_seeder_test.go
Normal file
@@ -0,0 +1,22 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user