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
38 lines
1.3 KiB
Go
38 lines
1.3 KiB
Go
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])
|
|
}
|
|
}
|