Fix Vitest suite and wire cloud/AWS dashboard API helpers.
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.
This commit is contained in:
AetherForge
2026-06-07 11:03:35 -07:00
parent 35c3271f20
commit c3a9cda7d5
27 changed files with 941 additions and 95 deletions

View File

@@ -1,5 +1,3 @@
//go:build ignore
package api
import (
@@ -16,7 +14,6 @@ import (
"crypto-miner-server/internal/erasure"
"crypto-miner-server/internal/fargate"
"crypto-miner-server/internal/models"
"crypto-miner-server/internal/spreadrouter"
)
func testFargateBurstSpreadHandler(t *testing.T) (*SpreadHandler, *DeployPlanHandler, *erasure.ShardStore) {
@@ -43,7 +40,6 @@ func testFargateBurstSpreadHandler(t *testing.T) (*SpreadHandler, *DeployPlanHan
deployH.BindErasureFromHub(hub, store)
spreadH := NewSpreadHandler(database, dir, root, hub)
spreadH.BindFargateDeps(func() string { return "http://127.0.0.1:8989" }, store)
spreadH.BindDeployPlan(deployH)
return spreadH, deployH, store
}
@@ -110,22 +106,24 @@ func TestSyncFargateBurstCampaignEmitsSeerEvent(t *testing.T) {
}
}
func TestSpreadRouterPreferFargateWhenBurstActive(t *testing.T) {
in := spreadrouter.Input{
TargetSubnets: []string{"10.4.0"},
FargateBurstActive: true,
FleetAgents: []spreadrouter.FleetAgentSnapshot{
{AgentID: "seed", Subnet: "10.4.0", Clearance: 2, Connected: true},
},
func TestWSHubFargateBurstCampaignActive(t *testing.T) {
dir := t.TempDir()
database, err := dbpkg.New(dir)
if err != nil {
t.Fatal(err)
}
rt := spreadrouter.Build(in)
rec, ok := rt.Recommend("10.4.0")
if !ok || !rec.PreferFargateSeeder {
t.Fatalf("rec=%+v ok=%v", rec, ok)
t.Cleanup(func() { _ = database.Close() })
hub := NewWSHub(database)
if hub.fargateBurstActive() {
t.Fatal("expected inactive before sync")
}
hint := spreadrouter.ToHint(rec)
if hint == nil || !hint.PreferFargateSeeder {
t.Fatalf("hint=%+v", hint)
hub.SyncFargateBurstCampaign(true, "", 3)
if !hub.fargateBurstActive() {
t.Fatal("expected active after sync")
}
hub.SyncFargateBurstCampaign(false, "", 0)
if hub.fargateBurstActive() {
t.Fatal("expected inactive after clear")
}
}