ADR 0593 §7: the composer with its refusals leaves mesh-sdk, so mesh-sdk carries no composition rule. The catalogue functions only the node-engine's composition reaches (Resolve, Resolution's Compose, Declaration, DataItems, LeftOut, Rules and the rest, the settings, placeholder and template refusals, the rendering helpers) are copied with their tests into internal/compose/resolution; a method of a mesh-sdk shape becomes a function taking it first. The composition calls its own copies, and the captured catalogue its tests read lives here now, shared by mesh-compose's tests. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
package resolution
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
mcat "git.novox.be/novox/mesh-sdk/go/catalogue"
|
|
)
|
|
|
|
func TestAScheduledContainerRendersWithTheCronField(t *testing.T) {
|
|
// The resolver carries `schedule` into the rendered host declaration untouched, exactly as it
|
|
// carries run-once — a container's keys are copied through, so the host receives the field as
|
|
// written.
|
|
digest := "@sha256:" + strings.Repeat("a", 64)
|
|
r := mcat.Resolution{Node: "laptop", Modules: []mcat.Manifest{{
|
|
Module: "kometa",
|
|
Resources: []map[string]any{
|
|
{"id": "sync", "type": "container", "name": "sync",
|
|
"image": "registry.example/runtime" + digest, "schedule": "0 3 * * *"},
|
|
},
|
|
}}}
|
|
out, err := Declaration(r, mcat.Rendering{})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
sync := indexOfID(out, "kometa.sync")
|
|
if sync == -1 {
|
|
t.Fatal("the scheduled container was lost in rendering")
|
|
}
|
|
if got, _ := out[sync]["schedule"].(string); got != "0 3 * * *" {
|
|
t.Errorf("schedule did not reach the host declaration: %+v", out[sync])
|
|
}
|
|
}
|