disk-load reads the node-engine's data state through the node-engine client and the seat's types (B5e; ADR 0634 §1, §4; issue 1966)

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
2026-11-05 15:28:35 +01:00
parent a609ebc8e5
commit 8fabdc4b91
6 changed files with 61 additions and 22 deletions
+14 -3
View File
@@ -10,9 +10,10 @@ import (
"time"
"git.novox.be/novox/mesh-catalog/modules/disk-load/diskreadings"
engineclient "git.novox.be/novox/mesh-contracts/go/clients/nodeengineclient"
nodeengine "git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/delivery"
)
// ADR 0577 clauses 2, 3 (and the disk-load check of clause 5): the items measured come from the node-engine's keys of
@@ -20,9 +21,9 @@ import (
// that changes after the watch began has its module measured again, and one deleted is measured no more; an item whose
// measurement fails is a failed item of the round, which measures the rest, and the round's key says so.
func TestTheItemsComeFromTheEnginesKeysAndARoundSaysHowFarItGot(t *testing.T) {
key := func(module string) string { k, _ := delivery.EngineDataKey("ace", module); return k }
key := func(module string) string { k, _ := engineclient.DataKey("ace", module); return k }
value := func(module string, items ...catalogue.PlacedDataItem) json.RawMessage {
raw, err := delivery.EncodeEngineData(delivery.EngineData{Node: "ace", Module: module, Digest: "sha256:" + module, Items: items})
raw, err := engineclient.EncodeData(nodeengine.DataByNodeModuleValue{V: 1, Node: "ace", Module: module, Digest: "sha256:" + module, Items: seatItems(items)})
if err != nil {
t.Fatal(err)
}
@@ -188,3 +189,13 @@ func waitFor(t *testing.T, done func() bool) {
}
t.Fatal("not done within 30 s")
}
// seatItems are measured items as the node-engine's state data keeps them.
func seatItems(in []catalogue.PlacedDataItem) []nodeengine.PlacedDataItem {
out := make([]nodeengine.PlacedDataItem, 0, len(in))
for _, it := range in {
out = append(out, nodeengine.PlacedDataItem{Module: it.Module, Item: it.ID, Class: it.Class, Path: it.Path,
CoveredBy: it.CoveredBy, Protection: it.Protection, Measure: it.Measure})
}
return out
}