Read the seat mesh-placement's state through the sdk's PlacementsOf, and write the test mesh's placement as the seat does, one key per module and node (issue 774, research 072 row 37)

This commit is contained in:
2026-10-31 09:29:32 +01:00
parent 747bfa71aa
commit 35a7ff70fe
4 changed files with 17 additions and 13 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ require (
)
require (
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261030143623-83cf97b690f5
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261031082815-98d5306d6b33
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op // indirect
github.com/google/go-tpm v0.9.8 // indirect
github.com/klauspost/compress v1.20.0 // indirect
+2 -2
View File
@@ -1,5 +1,5 @@
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261030143623-83cf97b690f5 h1:hyyaB1rU7uzlQZvWAxZ9P6pL/4LCFpOVXMRgn9F7fic=
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261030143623-83cf97b690f5/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261031082815-98d5306d6b33 h1:D+WeYpINV0xPPyBp8jEu7KdfD5WtBwQY22/X4J5AiR8=
git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261031082815-98d5306d6b33/go.mod h1:ouERNpZizzwZ0HLEtAypsY9FR20FyUgUYRni6J7kVCY=
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op h1:Z/MZK75wC/NSrkgqeNIa7jexam9uWzhLmFTSCPI/kn0=
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI=
github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo=
+6 -7
View File
@@ -398,14 +398,13 @@ func recordsOn(conn *bus.Conn) (recorded []recordedModule, machines []string, wh
}
machines = delivery.MachineNames(placements)
on := map[string][]string{}
// The placement's keys in either form, a node key and its module keys or the form before (research 072 row 37).
assembled, err := delivery.PlacementsOf(placements)
if err != nil {
why = append(why, delivery.PlacementRead+" (not every key is a placement: "+err.Error()+")")
}
for _, node := range machines {
key, _ := delivery.PlacementKey(node)
var p delivery.Placement
if json.Unmarshal(placements[key], &p) != nil {
why = append(why, delivery.PlacementRead+" ("+key+" is not a placement)")
continue
}
for _, m := range p.Modules {
for _, m := range assembled[node].Modules {
on[m.Module] = append(on[m.Module], node)
}
}
+8 -3
View File
@@ -201,11 +201,16 @@ func (m *Mesh) Placed(t *testing.T, tools map[string][]string, on map[string][]s
for _, module := range placed {
p.Modules = append(p.Modules, delivery.PlacedModule{Module: module})
}
raw, _ := json.Marshal(p)
key, _ := delivery.PlacementKey(node)
if _, err := placement.Put(key, raw); err != nil {
// As the seat writes it: its node key and a key per module (research 072 row 37).
values, err := delivery.PlacementValues(p)
if err != nil {
t.Fatal(err)
}
for key, raw := range values {
if _, err := placement.Put(key, raw); err != nil {
t.Fatal(err)
}
}
}
}