package catalogue import ( "strings" "testing" ) // A scheduled container is the recurring twin of run-once (novox/hq ADR 0053). The control plane's // part is small and exact: carry the field to the host unchanged, and refuse a malformed schedule — // or the contradictory pair run-once + schedule — near its author rather than on the machine. These // tests defend that. 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 := Resolution{Node: "laptop", Modules: []Manifest{{ Module: "kometa", Resources: []map[string]any{ {"id": "sync", "type": "container", "name": "sync", "image": "registry.example/runtime" + digest, "schedule": "0 3 * * *"}, }, }}} out, err := r.Declaration(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]) } }