Close test-gap noise rows and sync coverage documentation.
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
Restore P1/P2/fleet/erasure COVERED rows in PROBLEMS.md with refreshed counts; drop fixed poll-duplication and Vitest-noise items. Silence ECONNREFUSED stderr in Vitest setup, alias download mock exports, and expand erasure/Path Tracer test coverage.
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"crypto-miner-server/internal/erasure"
|
||||
)
|
||||
|
||||
func postDeployPlan(t *testing.T, h *DeployPlanHandler, body string) map[string]interface{} {
|
||||
@@ -109,6 +111,38 @@ func TestPostDeployPlanHTTPLinuxLOTL(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPostDeployPlanHTTPErasureEnabled(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
writeDeploySpreadTemplates(t, root)
|
||||
h := testDeployPlanHandlerWithRoot(t, root)
|
||||
store := erasure.NewShardStore()
|
||||
h.BindErasure(func() bool { return true }, store)
|
||||
|
||||
out := postDeployPlan(t, h, `{
|
||||
"services":[{"name":"DoSvc","status":"running"}],
|
||||
"platform":"windows","build_id":"b1","campaign":"erasure-wave"
|
||||
}`)
|
||||
plan, ok := out["plan"].(map[string]interface{})
|
||||
if !ok {
|
||||
t.Fatalf("plan=%v", out["plan"])
|
||||
}
|
||||
erasurePlan, ok := plan["erasure_plan"].(map[string]interface{})
|
||||
if !ok || erasurePlan["enabled"] != true {
|
||||
t.Fatalf("erasure_plan=%v", plan["erasure_plan"])
|
||||
}
|
||||
shards, ok := erasurePlan["shards"].([]interface{})
|
||||
if !ok || len(shards) != 6 {
|
||||
t.Fatalf("shards=%v", erasurePlan["shards"])
|
||||
}
|
||||
token, _ := erasurePlan["shard_token"].(string)
|
||||
if token == "" {
|
||||
t.Fatal("expected shard_token")
|
||||
}
|
||||
if _, ok := store.Get(token, 0); !ok {
|
||||
t.Fatal("expected stored shard for HTTP deploy plan")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPostDeployPlanHTTPRejectsEmptyServices(t *testing.T) {
|
||||
h := testDeployPlanHandler(t)
|
||||
srv := httptest.NewServer(http.HandlerFunc(h.PostDeployPlan))
|
||||
|
||||
Reference in New Issue
Block a user