Bound pool declaration reads and document operator commands
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user