Files
mesh-delivery/modules/mesh-delivery-builder/buildrun/faults_test.go
T
jschoubben f6e7f4210b B9: a fetch or a publish met away ends its run again, by again-delays, with no seat call
The build modules' shared steprun parts of §799: again-delays (15s,60s) read
into a Puller's Delay; a fetch's 401/5xx or connection fault and a publish's
no responders or exited bundle are transport faults whose why opens fetch: or
publish:; the assigner call that named a silent holder goes. The builder reads
an exited bundle as no responders and keeps the part in a key's fault words.

Builds: design 47 H2 §799 (H-A-390)
2026-11-22 00:20:17 +01:00

36 lines
1.7 KiB
Go

package buildrun
import (
"strings"
"testing"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
)
// Design 47 G §568, A-76: the class of a transport fault is read from the call's error, and its words are one form.
func TestFaultClassAndWords(t *testing.T) {
for cause, class := range map[string]string{
"nats: no responders available for request": ClassNoResponders,
"publish: the bundle exited": ClassNoResponders,
"fetch: git fetch: The requested URL returned error: 401": ClassConnection,
"lookup proxy: no such host": ClassNameLookup,
"Get https://r: context deadline exceeded": ClassDeadline,
"read tcp: i/o timeout": ClassDeadline,
"dial tcp: connection refused": ClassConnection,
"ssh: kex_exchange_identification: read: reset": ClassConnection,
} {
if got := FaultClass(cause); got != class {
t.Errorf("FaultClass(%q) = %q, want %q", cause, got, class)
}
}
if got, want := TransportFault(ClassDeadline, "node-build-go", "ace", "i/o timeout"), "transport fault: deadline, node-build-go ace, i/o timeout"; got != want {
t.Errorf("TransportFault = %q, want %q", got, want)
}
// §799: a fetch's and a publish's why are said apart, each in the cause of its key's transport fault.
for _, why := range []string{"fetch: git fetch: HTTP 503", "publish: nats: no responders available for request"} {
if got := TransportFault(FaultClass(why), "node-build-go", "ace", why); !builds.FailedOnTransportFault(got) || !strings.HasSuffix(got, ", "+why) {
t.Errorf("TransportFault of %q = %q", why, got)
}
}
}