Skip to content

Commit

Permalink
Fix VA deletion check in e2e testing
Browse files Browse the repository at this point in the history
Check with Consistently instead of Eventually and use offset
  • Loading branch information
razo7 committed Aug 14, 2023
1 parent b256c1b commit 6a8cb31
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/e2e/far_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ var _ = Describe("FAR E2e", func() {
pod = e2eUtils.GetPod(nodeName, testContainerName)
pod.Name = testPodName
pod.Namespace = testNsName
Expect(k8sClient.Create(context.Background(), pod)).To(Succeed())
ExpectWithOffset(1, k8sClient.Create(context.Background(), pod)).To(Succeed())
log.Info("Tested pod has been created", "pod", testPodName)
creationTimePod = metav1.Now().Time
va = createVA(nodeName)
Expand Down Expand Up @@ -405,7 +405,7 @@ func wasNodeRebooted(nodeName string, nodeBootTimeBefore time.Time) {

// checkVaDeleted verifies if the va has already been deleted due to resource deletion
func checkVaDeleted(va *storagev1.VolumeAttachment) {
EventuallyWithOffset(1, func() bool {
ConsistentlyWithOffset(1, func() bool {
newVa := &storagev1.VolumeAttachment{}
err := k8sClient.Get(context.Background(), client.ObjectKeyFromObject(va), newVa)
return apiErrors.IsNotFound(err)
Expand Down Expand Up @@ -455,12 +455,12 @@ func checkRemediation(nodeName string, nodeBootTimeBefore time.Time, oldPodCreat
By("Getting new node's boot time")
wasNodeRebooted(nodeName, nodeBootTimeBefore)

By("checking if old VA has been deleted")
checkVaDeleted(va)

By("checking if old pod has been deleted")
checkPodDeleted(pod)

By("checking if old volume attachment has been deleted")
checkVaDeleted(va)

By("checking if the status conditions match a successful remediation")
verifyExpectedStatusConditionError(nodeName, commonConditions.ProcessingType, utils.ConditionSetAndMatchSuccess, metav1.ConditionFalse)
verifyExpectedStatusConditionError(nodeName, v1alpha1.FenceAgentActionSucceededType, utils.ConditionSetAndMatchSuccess, metav1.ConditionTrue)
Expand Down

0 comments on commit 6a8cb31

Please sign in to comment.