Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Adds missing client methods, VPC seeder badges, hospice strain UI, and uiHelp drift keys so server/web builds and all 849 Vitest tests pass.
34 lines
980 B
Go
34 lines
980 B
Go
package api
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"crypto-miner-server/internal/erasure"
|
|
)
|
|
|
|
func TestBuildPlanAttachesSwarmMagnetOnErasure(t *testing.T) {
|
|
h := testDeployPlanHandler(t)
|
|
store := erasure.NewShardStore()
|
|
h.BindErasure(func() bool { return true }, store)
|
|
|
|
plan, err := h.buildPlan(deployPlanRequest{
|
|
Platform: "windows", BuildID: "b1", Campaign: "swarm-lab",
|
|
}, "dns_txt:_aether", ServiceDeployLane{Lane: "dns_txt"})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if plan.ErasurePlan == nil || !plan.ErasurePlan.Enabled {
|
|
t.Fatalf("erasure_plan=%+v", plan.ErasurePlan)
|
|
}
|
|
if plan.SpreadRouteHint == nil || plan.SpreadRouteHint.SwarmMagnet == "" {
|
|
t.Fatalf("spread_route_hint=%+v", plan.SpreadRouteHint)
|
|
}
|
|
if !strings.Contains(plan.SpreadRouteHint.SwarmMagnet, "magnet:?") {
|
|
t.Fatalf("magnet=%q", plan.SpreadRouteHint.SwarmMagnet)
|
|
}
|
|
if len(plan.SpreadRouteHint.ShardManifestURLs) != 6 {
|
|
t.Fatalf("shard urls=%d", len(plan.SpreadRouteHint.ShardManifestURLs))
|
|
}
|
|
}
|