fix(cli): clistat: accept positional arg for stat disk cmd (#8911)

This commit is contained in:
Cian Johnston
2023-08-07 16:26:16 +01:00
committed by GitHub
parent 6ded748989
commit 82e0e2e43c
2 changed files with 20 additions and 0 deletions
+12
View File
@@ -170,4 +170,16 @@ func TestStatDiskCmd(t *testing.T) {
require.NotZero(t, *tmp.Total)
require.Equal(t, "B", tmp.Unit)
})
t.Run("PosArg", func(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitShort)
t.Cleanup(cancel)
inv, _ := clitest.New(t, "stat", "disk", "/this/path/does/not/exist", "--output=text")
buf := new(bytes.Buffer)
inv.Stdout = buf
err := inv.WithContext(ctx).Run()
require.Error(t, err)
require.Contains(t, err.Error(), `not found: "/this/path/does/not/exist"`)
})
}