Two halves of one gap the first build over the new bus met. The machine decided its bus from a variable its container never received, so the credential the mesh sealed to it went unread; a credential for the new bus names the bus by scheme and carries user, password and fingerprint beside the address, and that is enough to dial it, pinned. And the roles' work queues were raised with no holders, so the consumer a machine binds to take work was never created: the holders are read from the catalogue and the handover record, as the resolver reads them.
45 lines
1.3 KiB
Go
45 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// **The genesis path writes its result to stdout and nothing else there.** The installer captures
|
|
// stdout alone and parses it as JSON; one stray log line makes that fail with "invalid character"
|
|
// — exactly what a builder fmt.Printf caused, breaking a build that had worked. This keeps
|
|
// diagnostics on stderr so a future print cannot repeat it silently.
|
|
func TestBuilderDiagnosticsStayOffStdout(t *testing.T) {
|
|
allowed := map[string]bool{
|
|
"string(body)": true, // once.go: the result JSON, which IS stdout
|
|
"version)": true, // --version
|
|
`"stopping")`: true, // the loop.s shutdown line
|
|
"usage)": true, // --help text, for a human
|
|
}
|
|
for _, file := range []string{"once.go", "main.go"} {
|
|
src, err := os.ReadFile(file)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for i, raw := range strings.Split(string(src), "\n") {
|
|
line := strings.TrimSpace(raw)
|
|
if !strings.HasPrefix(line, "fmt.Printf(") &&
|
|
!strings.HasPrefix(line, "fmt.Println(") &&
|
|
!strings.HasPrefix(line, "fmt.Print(") {
|
|
continue
|
|
}
|
|
ok := false
|
|
for token := range allowed {
|
|
if strings.Contains(line, token) {
|
|
ok = true
|
|
}
|
|
}
|
|
if !ok {
|
|
t.Errorf("%s:%d writes a diagnostic to stdout, which the installer parses as JSON:\n %s",
|
|
file, i+1, line)
|
|
}
|
|
}
|
|
}
|
|
}
|