node-engine: the refused composition test asserts nothing was written (1984/AC15)

Builds: design 47 G A-342
This commit is contained in:
2026-11-25 15:00:26 +01:00
parent 32c57111d6
commit c312e6a30e
+5 -1
View File
@@ -42,7 +42,7 @@ func TestAFileItCannotProduceIsNeverWrittenEmpty(t *testing.T) {
t.Fatalf("a file with its content was refused: %v", refuseEmptyWrites(d)) t.Fatalf("a file with its content was refused: %v", refuseEmptyWrites(d))
} }
// Design 47 G A-342, through the module's apply (applyComposition and declarationOf, not Apply by hand): a process a // 1984/AC15, design 47 G A-342, through the module's apply (applyComposition and declarationOf, not Apply by hand): a process a
// composition places runs with its node's name as MESH_NODE; a composition naming no node, or compositions of two, are // composition places runs with its node's name as MESH_NODE; a composition naming no node, or compositions of two, are
// refused and nothing is applied. // refused and nothing is applied.
t.Run("AProcessAComposedModulePlacesRunsWithItsNodesName", func(t *testing.T) { t.Run("AProcessAComposedModulePlacesRunsWithItsNodesName", func(t *testing.T) {
@@ -79,6 +79,10 @@ func TestAFileItCannotProduceIsNeverWrittenEmpty(t *testing.T) {
if _, err := declarationOf(engcomp.Composed{Node: "ace"}, engcomp.Composed{Node: "g14"}); err == nil { if _, err := declarationOf(engcomp.Composed{Node: "ace"}, engcomp.Composed{Node: "g14"}); err == nil {
t.Error("compositions of two nodes were not refused") t.Error("compositions of two nodes were not refused")
} }
// Refused loudly means nothing applied: no unit was written by either refusal.
if _, err := os.Stat(filepath.Join(units, "signin.service")); err == nil {
t.Error("a refused composition wrote its unit")
}
res := applyComposition(context.Background(), opts, engcomp.Composed{Node: "ace", Module: "signin", Resources: []json.RawMessage{proc}}, res := applyComposition(context.Background(), opts, engcomp.Composed{Node: "ace", Module: "signin", Resources: []json.RawMessage{proc}},
nil, nil, nil, nil, say) nil, nil, nil, nil, say)
if res.Detail != "" { if res.Detail != "" {