nodeengineclient: a composition names the digests of the templates archives it was rendered from (A-481, A-481a)

Builds: design 47 G A-481, A-481a
This commit is contained in:
2026-11-17 23:42:11 +01:00
parent ba11b5e9e3
commit 36e78f5ff0
5 changed files with 30 additions and 4 deletions
@@ -60,6 +60,7 @@ func TestCompositionDigests(t *testing.T) {
{"one package", Composition{Node: "ace", Module: "buildah", FP: fp(7), Resources: by["buildah"]}, "sha256:84e480a7a62333960b3e4be21a7548bbaa09572ef73ca8fb9dc6dfd1228aeb6b"},
{"a service and a file", Composition{Node: "ace", Module: "mesh-wireguard", FP: fp(14), Resources: by["mesh-wireguard"]}, "sha256:d6edec2474f606503e55d4ee2e0b4f5d1ffc25d016e4bc595e86ea67fe205b8c"},
{"a plan beside the resources", Composition{Node: "ace", Module: "hostname", FP: fp(8), Resources: by["hostname"], Plan: json.RawMessage(`{"files":[{"path":"/etc/hostname"}]}`)}, "sha256:49e17d6c471ee65cdef745ca3ac5cea4d37b6a100e11d8434dc64a6e2949e57e"},
{"the templates archives it was rendered from", Composition{Node: "ace", Module: "hostname", FP: fp(8), Resources: by["hostname"], Templates: []string{"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"}}, "sha256:342df17a2e81fc08911452ecf1f37c6267aa58b66b26109b8e10253196248364"},
}
for _, c := range cases {
got, err := ComposedDigest(c.c)
@@ -107,6 +108,8 @@ func TestCompositionRefusals(t *testing.T) {
{"a resource of another module", Composition{Node: "ace", Module: "hostname", FP: fp(8), Resources: ok.Resources}, "is of"},
{"the node's own parts on a module", Composition{Node: "ace", Module: "buildah", FP: fp(7), Own: seat.NodeOwn{ProvisionerAccount: "x"}}, "node's own parts"},
{"a refusal that holds resources", Composition{Node: "ace", Module: "buildah", FP: fp(7), Resources: ok.Resources, Refused: "no secret"}, "refused and holds"},
{"templates digests not sorted", Composition{Node: "ace", Module: "hostname", FP: fp(8), Resources: by["hostname"], Templates: []string{"sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}}, "not sorted"},
{"a templates digest of no form", Composition{Node: "ace", Module: "hostname", FP: fp(8), Resources: by["hostname"], Templates: []string{"abc"}}, "templates digest"},
{"the node's own with a fingerprint", Composition{Node: "ace", FP: fp(7)}, "names no fingerprint"},
{"a node name with a dot", Composition{Node: "a.ce"}, "node"},
}