mesh/delivery-group group fix/r6-node-composition held: a member is held: novox/mesh-sdk@10b6e202320f (merged without a passing check: only a person decides wh…
mesh/delivery held for a person: merged without a passing check: only a person decides what follows
mesh/check checking 4e6b756bd225 on b833d09d2872 | novox/mesh-host#135 in group fix/r6-node-composition
34 lines
1.5 KiB
Go
34 lines
1.5 KiB
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/delivery"
|
|
)
|
|
|
|
// A composition that names a file the provisioner fills without saying it is filled would have this node-engine write
|
|
// that file empty: its apply is refused, loudly, before anything is written (issue 1945, live on 2026-10-25 at 01:22,
|
|
// when ace, g14 and shanks wrote claude-code's, node-env's and power's files empty).
|
|
func TestAFileItCannotProduceIsNeverWrittenEmpty(t *testing.T) {
|
|
unit := json.RawMessage(`{"id":"power.after-boot-unit","type":"file","path":"/etc/systemd/system/mesh-power-after-boot.service","mode":"0644","owner-at-runtime":"owned"}`)
|
|
c := delivery.Composed{Node: "ace", Resources: []json.RawMessage{unit}}
|
|
d, err := declarationOf(c)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := refuseEmptyWrites(d); err == nil || !strings.Contains(err.Error(), "power.after-boot-unit") {
|
|
t.Fatalf("a file the provisioner fills, not filled here: %v", err)
|
|
}
|
|
c.Filled = []string{"/etc/systemd/system/mesh-power-after-boot.service"}
|
|
if d, _ = declarationOf(c); refuseEmptyWrites(d) != nil {
|
|
t.Fatalf("a filled file was refused: %v", refuseEmptyWrites(d))
|
|
}
|
|
plain := delivery.Composed{Node: "ace", Resources: []json.RawMessage{json.RawMessage(
|
|
`{"id":"x.f","type":"file","path":"/etc/x","mode":"0644","content":"x"}`)}}
|
|
if d, _ = declarationOf(plain); refuseEmptyWrites(d) != nil {
|
|
t.Fatalf("a file with its content was refused: %v", refuseEmptyWrites(d))
|
|
}
|
|
}
|