Issue 1585, S19: the strict parser, every manifest problem function and the judge's tables (192 declarations, about 5,200 lines) and their 244 tests leave; composition keeps its own refusals and the helpers it uses. The catalogue's tests decode the manifests they build. ParseManifest, ParseManifestWith, ParseManifestForInputs, CatalogueProblems and the rest are gone; mesh-delivery-indexer/judge holds them. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
37 lines
1.9 KiB
Go
37 lines
1.9 KiB
Go
package catalogue
|
|
|
|
// A definition's directories and files are judged at their resolved paths when the definition is (novox/hq issue
|
|
// 496). mesh-catalog #205 gave docker's `state` directory `"place": "."`, which resolves to <root>/docker —
|
|
// /var/lib/docker, every container's filesystem. The merge gate composed every machine and passed it; only the
|
|
// node-engine refused it, at apply, and failed the walk. ParseManifest is what `module check`, registration and the
|
|
// merge gate's reading of a changed repository all run, so a refusal here is a refusal at each of them.
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestTheMeshsPlaceForDockerIsAccepted(t *testing.T) {
|
|
// The fix #205 needed: the mesh's own directory for the module, <root>/mesh/docker.
|
|
m, err := decodeForTest([]byte(`{"module": "docker", "version": "1", "resources": [
|
|
{"id": "state", "type": "directory", "place": "mesh"},
|
|
{"id": "marker", "type": "file", "path": "${dir:state}/applied", "content": "x"}]}`))
|
|
if err != nil {
|
|
t.Fatalf("place %q is in the mesh's tree, where the mesh writes for every module: %v", "mesh", err)
|
|
}
|
|
if got := dirsFor(m, Rendering{}); got["state"] != "/var/lib/mesh/docker" {
|
|
t.Fatalf("got %v", got)
|
|
}
|
|
}
|
|
|
|
func TestComposingAMachineIsNeverStoppedByOneModulesPath(t *testing.T) {
|
|
// A module registered from outside the catalogue never passes the gate. Refusing its path while a machine's
|
|
// declaration is composed would fail the whole declaration and freeze every module on that machine; the
|
|
// node-engine fails only the one resource. So composition leaves it to the engine.
|
|
m := Manifest{Module: "docker", Version: "1", Resources: []map[string]any{
|
|
{"id": "state", "type": "directory", "place": "."},
|
|
}}
|
|
if _, err := (Resolution{Node: "anchor", Modules: []Manifest{m}}).Declaration(Rendering{}); err != nil {
|
|
t.Fatalf("the machine's declaration failed for one module's path: %v", err)
|
|
}
|
|
}
|