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:
46
agent/config/genealogy_test.go
Normal file
46
agent/config/genealogy_test.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package config
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestSpreadStrainFromJoinLane(t *testing.T) {
|
||||
a := SpreadStrainFromJoinLane("winrm")
|
||||
b := SpreadStrainFromJoinLane("winrm")
|
||||
if a == "" || a != b {
|
||||
t.Fatalf("strain not stable: %q vs %q", a, b)
|
||||
}
|
||||
if a[0] != '#' || len(a) != 7 {
|
||||
t.Fatalf("expected #RRGGBB, got %q", a)
|
||||
}
|
||||
if SpreadStrainFromJoinLane("dns_txt") == a {
|
||||
t.Fatal("different lanes should produce different strains")
|
||||
}
|
||||
if SpreadStrainFromJoinLane("") != "" {
|
||||
t.Fatal("empty lane should yield empty strain")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenealogyReportBakedAndRuntime(t *testing.T) {
|
||||
cfg := RuntimeConfig{BuiltinConfig: BuiltinConfig{
|
||||
ParentAgentID: "parent-uuid",
|
||||
SpreadGeneration: 2,
|
||||
BakedJoinLane: "gpo",
|
||||
}}
|
||||
parent, gen, strain := cfg.GenealogyReport("")
|
||||
if parent != "parent-uuid" || gen != 2 {
|
||||
t.Fatalf("baked parent/gen: %q %d", parent, gen)
|
||||
}
|
||||
if strain != SpreadStrainFromJoinLane("gpo") {
|
||||
t.Fatalf("strain from baked join lane: %q", strain)
|
||||
}
|
||||
|
||||
cfg2 := RuntimeConfig{BuiltinConfig: BuiltinConfig{SpreadGeneration: 0}}
|
||||
t.Setenv("AETHER_PARENT_AGENT_ID", "env-parent")
|
||||
t.Setenv("AETHER_SPREAD_GENERATION", "3")
|
||||
p2, g2, s2 := cfg2.GenealogyReport("winrm")
|
||||
if p2 != "env-parent" || g2 != 3 {
|
||||
t.Fatalf("env overrides: %q %d", p2, g2)
|
||||
}
|
||||
if s2 != SpreadStrainFromJoinLane("winrm") {
|
||||
t.Fatalf("runtime join lane strain: %q", s2)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user