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

@@ -85,6 +85,30 @@ func TestAuthSubnetPrimarySeederHint(t *testing.T) {
}
}
func TestFleetTorrentGossipSameVPCScope(t *testing.T) {
database, err := db.New(t.TempDir())
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = database.Close() })
hub := NewWSHub(database)
hub.SetServerPolicy(ServerPolicy{FleetTorrentEnabled: true})
hub.storeAgentCloudMeta("vpc-a", CloudInstanceMeta{VpcID: "vpc-42", Region: "us-east-1"})
hub.storeAgentCloudMeta("vpc-b", CloudInstanceMeta{VpcID: "vpc-42", Region: "us-east-1"})
_ = database.UpsertAgent(&models.Agent{ID: "vpc-a", Name: "a", IP: "10.10.1.1", Status: "online"})
_ = database.UpsertAgent(&models.Agent{ID: "vpc-b", Name: "b", IP: "10.20.2.2", Status: "online"})
if scope := primarySeederScope("10.10.1.1", hub.agentCloudMetaLocked("vpc-a")); scope != "vpc-42" {
t.Fatalf("scope=%q", scope)
}
if !hub.agentMatchesPrimaryScopeLocked("vpc-a", "vpc-42") {
t.Fatal("expected vpc-a in vpc-42")
}
if hub.agentMatchesPrimaryScopeLocked("vpc-b", "vpc-99") {
t.Fatal("expected vpc-b mismatch on other vpc")
}
}
func TestSubnetPrimarySeederElection(t *testing.T) {
database, err := db.New(t.TempDir())
if err != nil {