The assigner holds a move of a module of policy record from the judgement beside its digest, so it is judged by ADR 0377 §3's tests against the composition the node's have names, a held one never taking its place, and written again when the have changes or a person sets the policy (ADR 0539 clauses 2 and 14). The node-engine's own file operator-keys, from its setting operator-signers, carries the operator's public keys (clause 3).
59 lines
2.3 KiB
Go
59 lines
2.3 KiB
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
|
"git.novox.be/novox/mesh-sdk/go/compose"
|
|
sdkdelivery "git.novox.be/novox/mesh-sdk/go/delivery"
|
|
)
|
|
|
|
// 1945/AC13: the node-engine's composition on a node carries the operator's public keys as its file operator-keys,
|
|
// from its setting operator-signers, beside the controller's key it already trusts (ADR 0539 clause 3, decided with the
|
|
// lead 2026-10-24: the switch's last declaration carries it because today's controller composes the same file from
|
|
// the same manifest). The manifest is mesh-host's module.json at 20d0998c (testdata/mesh-host-module.json), never
|
|
// typed by hand.
|
|
func TestTheNodeEnginesCompositionCarriesTheOperatorsKeys(t *testing.T) {
|
|
raw, err := os.ReadFile("testdata/mesh-host-module.json")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var m catalogue.Manifest
|
|
if err := json.Unmarshal(raw, &m); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
// Its archive names a build artifact, which only its registration turns into a reference: left out here, the rest of
|
|
// the manifest as captured.
|
|
var kept []map[string]any
|
|
for _, r := range m.Resources {
|
|
if r["type"] != "archive" {
|
|
kept = append(kept, r)
|
|
}
|
|
}
|
|
m.Resources = kept
|
|
const key = "MCowBQYDK2VwAyEAb3BlcmF0b3Itc2lnbmluZy1rZXktZm9yLXRlc3RzLW9ubHk="
|
|
in := compose.Input{Catalogue: map[string]catalogue.Manifest{m.Module: m},
|
|
Nodes: []compose.Node{{Name: "ace", Assigned: []string{m.Module}, Stated: true,
|
|
Settings: map[string][]catalogue.Layer{m.Module: {{From: "mesh", Values: map[string]any{"operator-signers": key}}}}}}}
|
|
fp := sdkdelivery.SourcePrefix2 + strings.Repeat("6", 64)
|
|
all, _, err := compose.Compositions(in, "ace", map[string]string{m.Module: fp}, compose.Reading)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
k, _ := sdkdelivery.ComposedKey("ace", m.Module, fp)
|
|
var file struct{ Path, Content string }
|
|
for _, r := range all[k].Resources {
|
|
var head struct{ ID, Path, Content string }
|
|
_ = json.Unmarshal(r, &head)
|
|
if strings.HasSuffix(head.ID, "operator-keys") {
|
|
file.Path, file.Content = head.Path, head.Content
|
|
}
|
|
}
|
|
if file.Path != "/var/lib/mesh-host/operator-keys" || file.Content != key+"\n" {
|
|
t.Errorf("the node-engine's composition carries operator-keys at %q with %q, want the operator's key", file.Path, file.Content)
|
|
}
|
|
}
|