Skip to content

Commit

Permalink
fix expect condition
Browse files Browse the repository at this point in the history
Signed-off-by: Ido Aharon <iaharon@redhat.com>
  • Loading branch information
ido106 committed Apr 17, 2023
1 parent 04fa501 commit 1ba621e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tests/cloner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ var _ = Describe("all clone tests", func() {
targetDvs = append(targetDvs, targetDv)
}

podsNodeName := make(map[string]string)
podsNodeName := make(map[string]bool)
for _, dv := range targetDvs {
By("Waiting for clone to be completed")
err = utils.WaitForDataVolumePhaseWithTimeout(f, f.Namespace.Name, cdiv1.Succeeded, dv.Name, 3*90*time.Second)
Expand Down Expand Up @@ -1032,7 +1032,7 @@ var _ = Describe("all clone tests", func() {
By(fmt.Sprintf("Getting pod %s/%s", dv.Namespace, cloneSourcePod))
pod, err := f.K8sClient.CoreV1().Pods(dv.Namespace).Get(context.TODO(), cloneSourcePod, metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred())
podsNodeName[dv.Name] = pod.Spec.NodeName
podsNodeName[pod.Spec.NodeName] = true
}

By("Deleting verifier pod")
Expand All @@ -1042,10 +1042,9 @@ var _ = Describe("all clone tests", func() {
Expect(err).ToNot(HaveOccurred())
}

// All pods should be in the same node
if len(podsNodeName) > 0 {
Expect(podsNodeName[targetDvs[0].Name]).To(Equal(podsNodeName[targetDvs[1].Name]))
Expect(podsNodeName[targetDvs[1].Name]).To(Equal(podsNodeName[targetDvs[2].Name]))
// All pods should be in the same node except when the map is empty in smart clone
if cloneType == "network" {
Expect(podsNodeName).To(HaveLen(1))
}
})

Expand Down

0 comments on commit 1ba621e

Please sign in to comment.