Skip to content

Commit

Permalink
tests: replace To(Equal(...)) to To(HaveLen(...))
Browse files Browse the repository at this point in the history
Replace Expect(len(...)).To(Equal(...))
with Expect(...).To(HaveLen(...)) to get
a better info when it fails.

Signed-off-by: Ben Oukhanov <[email protected]>
  • Loading branch information
codingben committed Mar 22, 2022
1 parent d6f82df commit 792517c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/util/hardware/hw_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var _ = Describe("Hardware utils test", func() {
cpusetLine := "0-2,7,12-14"
lst, err := ParseCPUSetLine(cpusetLine, 100)
Expect(err).ToNot(HaveOccurred())
Expect(len(lst)).To(Equal(7))
Expect(lst).To(HaveLen(7))
Expect(lst).To(Equal(expectedList))
})

Expand Down
4 changes: 2 additions & 2 deletions pkg/util/lookup/lookup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var _ = Describe("Lookup", func() {

returnedVMIs, err := VirtualMachinesOnNode(virtClient, "node01")
Expect(err).ToNot(HaveOccurred())
Expect(len(returnedVMIs)).To(Equal(2))
Expect(returnedVMIs).To(HaveLen(2))
})

It("should return active vmis on a node", func() {
Expand All @@ -63,7 +63,7 @@ var _ = Describe("Lookup", func() {

returnedVMIs, err := ActiveVirtualMachinesOnNode(virtClient, "node01")
Expect(err).ToNot(HaveOccurred())
Expect(len(returnedVMIs)).To(Equal(1))
Expect(returnedVMIs).To(HaveLen(1))
Expect(returnedVMIs[0].Status.Phase).To(Equal(virtv1.Running))
})

Expand Down

0 comments on commit 792517c

Please sign in to comment.