Bound pool declaration reads and document operator commands

This commit is contained in:
2026-10-18 23:43:58 +01:00
parent 28dac46a80
commit 80a1d1e0ea
3 changed files with 45 additions and 2 deletions
+16
View File
@@ -415,6 +415,22 @@ func TestResourcePoolOperatorCLIConfigureReadbackAndPreserveLease(t *testing.T)
t.Fatal(err)
}
var out bytes.Buffer
for _, fromStdin := range []bool{false, true} {
oversized := strings.Repeat(" ", 256*1024+1)
path := filepath.Join(t.TempDir(), "oversized.json")
if err := os.WriteFile(path, []byte(oversized), 0600); err != nil {
t.Fatal(err)
}
if fromStdin {
path = "-"
}
bounded := cli.App{Out: &out, Err: &out, In: strings.NewReader(oversized)}
err := bounded.Run(ctx, []string{"--url", endpoint, "resource-pool-configure", path, "--yes", "--json"})
if err == nil || !strings.Contains(err.Error(), "exceeds 262144 bytes") {
t.Fatalf("oversized pool input (stdin=%v): %v", fromStdin, err)
}
out.Reset()
}
app := cli.App{Out: &out, Err: &out, In: strings.NewReader("")}
if err := app.Run(ctx, []string{"--url", "ws" + strings.TrimPrefix(srv.URL, "http"), "resource-pool-configure", declaration, "--yes", "--json"}); err != nil {
t.Fatalf("configure CLI: %v\n%s", err, out.String())