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:
43
server/internal/atlas/lan_gossip_test.go
Normal file
43
server/internal/atlas/lan_gossip_test.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package atlas
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestSubnetPrefixIPv4(t *testing.T) {
|
||||
if got := SubnetPrefix("192.168.1.42"); got != "192.168.1" {
|
||||
t.Fatalf("SubnetPrefix = %q", got)
|
||||
}
|
||||
if got := SubnetPrefix("192.168.1.42:12345"); got != "192.168.1" {
|
||||
t.Fatalf("SubnetPrefix host:port = %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeGossipHints(t *testing.T) {
|
||||
hints := NormalizeGossipHints([]GossipHint{
|
||||
{Tier: " docker ", Condition: "no_docker", Reason: "blocked"},
|
||||
{Tier: "", Condition: "x"},
|
||||
{Tier: "wsl", Condition: "defender_on"},
|
||||
})
|
||||
if len(hints) != 2 {
|
||||
t.Fatalf("want 2 hints, got %+v", hints)
|
||||
}
|
||||
if hints[0].Tier != "docker" || hints[0].Reason != "blocked" {
|
||||
t.Fatalf("first hint = %+v", hints[0])
|
||||
}
|
||||
if hints[1].Reason != "lan gossip" {
|
||||
t.Fatalf("default reason = %q", hints[1].Reason)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMergeGossipSkipsDedupes(t *testing.T) {
|
||||
existing := []AtlasSkip{{Tier: "docker", Condition: "no_docker", Reason: "fleet"}}
|
||||
merged := MergeGossipSkips(existing, []GossipHint{
|
||||
{Tier: "docker", Condition: "no_docker", Reason: "lan"},
|
||||
{Tier: "wsl", Condition: "defender_on", Reason: "lan"},
|
||||
})
|
||||
if len(merged) != 2 {
|
||||
t.Fatalf("merged = %+v", merged)
|
||||
}
|
||||
if merged[1].Tier != "wsl" {
|
||||
t.Fatalf("second skip = %+v", merged[1])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user