Skip to content

Commit

Permalink
fix(test): fixing resize flaky test case
Browse files Browse the repository at this point in the history
We are comparing the desired size to the wrong field
because of that resize test is not executing correctly
and sometimes causing test case failure in travis.

The update call is failing sometimes while executing the zfs
property update test cases as for resize also the object
is getting modified. The test case will fail when object updation
happens between volume GET and UPDATE call while performing
zfs property update test case to set various properties on
ZFSVolume resource.

Signed-off-by: Pawan <pawan@mayadata.io>
  • Loading branch information
pawanpraka1 committed Mar 26, 2020
1 parent 1ed9ce5 commit ef9c1df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ci/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ echo "get all the pods"
kubectl get pods -owide --all-namespaces

echo "get pvc and pv details"
kubectl get pvc,pv --all-namespaces
kubectl get pvc,pv -oyaml --all-namespaces

echo "get sc details"
kubectl get sc --all-namespaces -oyaml
Expand Down
6 changes: 3 additions & 3 deletions tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ func IsPVCBoundEventually(pvcName string) bool {

// IsPVCResizedEventually checks if the pvc is bound or not eventually
func IsPVCResizedEventually(pvcName string, newCapacity string) bool {
newStorage, err := resource.ParseQuantity(NewCapacity)
newStorage, err := resource.ParseQuantity(newCapacity)
if err != nil {
return false
}
return Eventually(func() bool {
volume, err := PVCClient.
Get(pvcName, metav1.GetOptions{})
Expect(err).ShouldNot(HaveOccurred())
pvcStorage := volume.Spec.Resources.Requests[corev1.ResourceName(corev1.ResourceStorage)]
pvcStorage := volume.Status.Capacity
return pvcStorage == newStorage
},
60, 5).
120, 5).
Should(BeTrue())
}

Expand Down

0 comments on commit ef9c1df

Please sign in to comment.