package catalogue import ( "encoding/json" "strings" "testing" ) // A scheduled step may hold its module's own containers still while it runs (novox/hq ADR 0189). // // The host judges what it receives — whether each id is a container on that machine. What the // definition is the only place to see is judged here, near whoever wrote it. func aStoreManifest(step map[string]any) []byte { m := map[string]any{ "module": "distribution", "version": "1", "resources": []any{ map[string]any{"id": "store", "type": "container", "name": "mesh-registry", "image": "registry@sha256:" + strings.Repeat("a", 64)}, step, }, } raw, _ := json.Marshal(m) return raw } func TestAMaintenanceWindowOnItsOwnModulesContainerIsAccepted(t *testing.T) { raw := aStoreManifest(map[string]any{ "id": "collect", "type": "container", "name": "mesh-registry-collect", "image": "registry@sha256:" + strings.Repeat("a", 64), "schedule": "30 3 * * *", "while-stopped": []any{"store"}, }) if _, err := decodeForTest(raw); err != nil { t.Fatalf("a step holding its own module's container still was refused: %v", err) } }