node list and module list answer --json, and the nodes and modules verbs use it (hq ADR 0195)

The console's discovery reads the machines and the modules; parsing a printed column breaks when it
is reworded. Both now answer JSON on --json, as status and seats do, and the seat verbs ask for it.
This commit is contained in:
jochen
2026-10-03 21:55:35 +02:00
parent 2ebbb79937
commit 85873b19e1
4 changed files with 73 additions and 2 deletions
+15
View File
@@ -2,6 +2,7 @@ package main
import (
"context"
"fmt"
"strings"
"testing"
@@ -249,3 +250,17 @@ func TestARowAheadOfThisBuildIsServedAnyway(t *testing.T) {
}
}
}
// novox/hq ADR 0195: the console's discovery reads the machines and the modules; they answer as JSON,
// as status and seats do, so nothing parses a printed column.
func TestTheNodesAndModulesVerbsAnswerAsJSON(t *testing.T) {
for verb, want := range map[string]string{"nodes": "[node list --json]", "modules": "[module list --json]"} {
argv, err := argvFor(verb, map[string]any{})
if err != nil {
t.Fatal(err)
}
if fmt.Sprint(argv) != want {
t.Errorf("%s runs %v, want %s", verb, argv, want)
}
}
}