Skip to content

Commit

Permalink
Nitpick fix: use HaveLen instead of len() in machine e23 list test
Browse files Browse the repository at this point in the history
Signed-off-by: Boaz Shuster <[email protected]>
  • Loading branch information
boaz0 committed Jun 27, 2022
1 parent f438d2e commit 3ac5f05
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/machine/e2e/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var _ = Describe("podman machine list", func() {
firstList, err := mb.setCmd(list).run()
Expect(err).NotTo(HaveOccurred())
Expect(firstList).Should(Exit(0))
Expect(len(firstList.outputToStringSlice())).To(Equal(1)) // just the header
Expect(firstList.outputToStringSlice()).To(HaveLen(1)) // just the header

i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
Expand All @@ -39,7 +39,7 @@ var _ = Describe("podman machine list", func() {
secondList, err := mb.setCmd(list).run()
Expect(err).NotTo(HaveOccurred())
Expect(secondList).To(Exit(0))
Expect(len(secondList.outputToStringSlice())).To(Equal(2)) // one machine and the header
Expect(secondList.outputToStringSlice()).To(HaveLen(2)) // one machine and the header
})

It("list machines with quiet or noheading", func() {
Expand All @@ -51,12 +51,12 @@ var _ = Describe("podman machine list", func() {
firstList, err := mb.setCmd(list.withQuiet()).run()
Expect(err).NotTo(HaveOccurred())
Expect(firstList).Should(Exit(0))
Expect(len(firstList.outputToStringSlice())).To(Equal(0)) // No header with quiet
Expect(firstList.outputToStringSlice()).To(HaveLen(0)) // No header with quiet

noheaderSession, err := mb.setCmd(list.withNoHeading()).run() // noheader
Expect(err).NotTo(HaveOccurred())
Expect(noheaderSession).Should(Exit(0))
Expect(len(noheaderSession.outputToStringSlice())).To(Equal(0))
Expect(noheaderSession.outputToStringSlice()).To(HaveLen(0))

i := new(initMachine)
session, err := mb.setName(name1).setCmd(i.withImagePath(mb.imagePath)).run()
Expand All @@ -70,7 +70,7 @@ var _ = Describe("podman machine list", func() {
secondList, err := mb.setCmd(list.withQuiet()).run()
Expect(err).NotTo(HaveOccurred())
Expect(secondList).To(Exit(0))
Expect(len(secondList.outputToStringSlice())).To(Equal(2)) // two machines, no header
Expect(secondList.outputToStringSlice()).To(HaveLen(2)) // two machines, no header

listNames := secondList.outputToStringSlice()
stripAsterisk(listNames)
Expand Down Expand Up @@ -119,7 +119,7 @@ var _ = Describe("podman machine list", func() {
listSession, err := mb.setCmd(list.withFormat("{{.Name}}").withNoHeading()).run()
Expect(err).NotTo(HaveOccurred())
Expect(listSession).To(Exit(0))
Expect(len(listSession.outputToStringSlice())).To(Equal(1))
Expect(listSession.outputToStringSlice()).To(ToHave(1))

listNames := listSession.outputToStringSlice()
stripAsterisk(listNames)
Expand Down

0 comments on commit 3ac5f05

Please sign in to comment.