mesh/merge-gate head 5c94759cc0c2 merged into trunk c8539bf35a8d — pass: builds mesh-controller → novox; no bus step; every machine composes with the chang…
mesh/repo-check head 5c94759cc0c2 merged into trunk c8539bf35a8d — pass: its merge-check.sh passed
mesh/delivery delivered
34 lines
1.2 KiB
Go
34 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"github.com/nats-io/nats.go"
|
|
|
|
"github.com/novox/mesh-controller/internal/link"
|
|
)
|
|
|
|
// **A merge the controller cannot act on is held, whatever the error** (issue 1583, after 921): the bus acknowledges an
|
|
// announcement only when hearMerge answers without ErrTryAgain, and a merge heard once is not announced again. The bus
|
|
// answering "jetstream not enabled" (mesh-catalog #404, 2026-10-21) is no outage of a kind notNow knows, and took the merge.
|
|
func TestAMergeThatFailsOnAnyErrorIsHeldAndNotTaken(t *testing.T) {
|
|
for name, cause := range map[string]error{
|
|
"jetstream not enabled": nats.ErrJetStreamNotEnabled,
|
|
"a bucket missing": errors.New("the bucket mesh-controller_builds is not on the bus"),
|
|
"no responders": nats.ErrNoResponders,
|
|
} {
|
|
held := heldMerge(cause)
|
|
if !errors.Is(held, link.ErrTryAgain) || !errors.Is(held, cause) {
|
|
t.Errorf("%s answers %v, which the bus takes as done", name, held)
|
|
}
|
|
}
|
|
if heldMerge(nil) != nil {
|
|
t.Error("a merge that was heard answers an error")
|
|
}
|
|
already := link.ErrTryAgain
|
|
if heldMerge(already) != already {
|
|
t.Error("a merge already held is wrapped again")
|
|
}
|
|
}
|