Files
mesh-sdk/go/catalogue/runonce_test.go
T
jschoubben 1c7356c247
mesh/delivery-group group feat/sdk1 rejected: composed together: the checker's verdict at the members' heads (428d048dd50a): unit: git.novox.be/novox/mesh-sdk/…
mesh/delivery closed: a newer head of the same pull request
mesh/check failed: unit: git.novox.be/novox/mesh-sdk/go/process.TestStatePutWritesAKeyWhole: a Put through a short blackout: 0, mesh-mail's state send…
catalogue: the composition's rules and refusals leave for the node-engine, so mesh-sdk renders no declaration and refuses no composition (ADR 0593 §7)
Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
2026-11-02 19:19:25 +01:00

26 lines
1.1 KiB
Go

package catalogue
import (
"strings"
"testing"
)
// A run-once container is a step the host runs to completion (novox/hq ADR 0052). The control
// plane's part is small and exact: carry the field to the host unchanged, keep the step ahead of
// the container it gates in author order, and refuse a malformed run-once near its cause rather
// than on the machine. These tests defend that.
func TestARunOnceStepMayNameWhatItReads(t *testing.T) {
// For a step, restart-on means *run again* when what it reads changed: a gate that fetches a
// provider's root names the binding file it reads, so a provider that moved is fetched again
// (novox/hq ADR 0099). Accepted here, and the host's digest does the rest.
digest := "@sha256:" + strings.Repeat("a", 64)
good := []byte(`{"module":"m","resources":[
{"id":"conf","type":"file","path":"/x","content":"y"},
{"id":"seed","type":"container","name":"seed","image":"registry.example/x` + digest + `","run-once":true,"restart-on":["conf"]}
]}`)
if _, err := decodeForTest(good); err != nil {
t.Errorf("a run-once step naming what it reads was refused: %v", err)
}
}