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 /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, /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) } }