diff --git a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/holder_test.go b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/holder_test.go index 49e8c2a0..0c5d84dd 100644 --- a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/holder_test.go +++ b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/holder_test.go @@ -5,6 +5,8 @@ import ( "strings" "testing" "time" + + sdk "git.novox.be/novox/mesh-sdk/go/delivery" ) // The holder, end to end over fakes (novox/hq ADR 0239 *How it is checked*, cut by ADR 0539 §17): a pull request's head @@ -238,6 +240,17 @@ func TestAMergedGroupEndsMergedWithSourceMainMoved(t *testing.T) { if w.source.main == nil || w.source.main.Heads["novox/a"] != strings.Repeat("p", 12) || w.source.main.Heads["novox/b"] != strings.Repeat("q", 12) { t.Fatalf("source.main is %+v, wanted both merges", w.source.main) } + // A merge that leaves no module.json carries no trees (issue 1367): the gate reads it, and refuses nothing. + msg := sdk.Forge{Kind: sdk.ForgeMerged, Repository: "novox/a", Number: 9, Head: strings.Repeat("e", 40), + Merge: strings.Repeat("f", 40), Root: "r"} + body, err := sdk.EncodeForge(msg) + if err != nil { + t.Fatalf("a merged message with no trees is refused: %v", err) + } + w.h.Forged("mesh-delivery-forge-bridge.novox.a.merged", body) + if len(w.h.refusals) != 0 { + t.Errorf("the gate refused a merged message with no trees: %v", w.h.refusals) + } } // ADR 0419 §2, issue 978: a description's `after:` line is not read, and says so once on its pull request. The