diff options
author | Boaz Shuster <boaz.shuster.github@gmail.com> | 2022-06-22 12:26:59 +0300 |
---|---|---|
committer | Boaz Shuster <boaz.shuster.github@gmail.com> | 2022-06-23 21:36:52 +0300 |
commit | f0b9e56e98e0adc3f0b0e736f36b4c964430b4e5 (patch) | |
tree | 7f1ef62e9e7be4e5bc99bd04e3dcfafca913db36 /pkg/machine | |
parent | 15a651f860191a6cfe0b3d5f1c0a846e6a584091 (diff) | |
download | podman-f0b9e56e98e0adc3f0b0e736f36b4c964430b4e5.tar.gz podman-f0b9e56e98e0adc3f0b0e736f36b4c964430b4e5.tar.bz2 podman-f0b9e56e98e0adc3f0b0e736f36b4c964430b4e5.zip |
Fix machine list: --format implies --noheading
It seems like previously if --format was changed then listFlag.noHeading is changed accordingly
however printHeader is used to determine whether to print header or not.
This patch fixes that problem.
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
Diffstat (limited to 'pkg/machine')
-rw-r--r-- | pkg/machine/e2e/list_test.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pkg/machine/e2e/list_test.go b/pkg/machine/e2e/list_test.go index 1c8c6ac81..00020cf4a 100644 --- a/pkg/machine/e2e/list_test.go +++ b/pkg/machine/e2e/list_test.go @@ -116,7 +116,7 @@ var _ = Describe("podman machine list", func() { // go format list := new(listMachine) - listSession, err := mb.setCmd(list.withFormat("{{.Name}}").withNoHeading()).run() + listSession, err := mb.setCmd(list.withFormat("{{.Name}}")).run() Expect(err).NotTo(HaveOccurred()) Expect(listSession).To(Exit(0)) Expect(len(listSession.outputToStringSlice())).To(Equal(1)) @@ -135,6 +135,15 @@ var _ = Describe("podman machine list", func() { var listResponse []*machine.ListReporter err = jsoniter.Unmarshal(listSession.Bytes(), &listResponse) Expect(err).To(BeNil()) + + // table format includes the header + list = new(listMachine) + listSession3, err3 := mb.setCmd(list.withFormat("table {{.Name}}")).run() + Expect(err3).NotTo(HaveOccurred()) + Expect(listSession3).To(Exit(0)) + listNames3 := listSession3.outputToStringSlice() + Expect(len(listNames3)).To(Equal(2)) + Expect(listNames3).To(ContainSubstring("NAME")) }) }) |