Unverified Commit 195092f1 authored by Kubernetes Prow Robot's avatar Kubernetes Prow Robot Committed by GitHub

Merge pull request #73139 from jsafrane/kms-no-events

Pass the test if an event is not delivered
parents cd18b8f8 9ed73a94
......@@ -844,7 +844,10 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() {
}
}()
// Watch events until the message about invalid key appears
// Watch events until the message about invalid key appears.
// Event delivery is not reliable and it's used only as a quick way how to check if volume with wrong KMS
// key was not provisioned. If the event is not delivered, we check that the volume is not Bound for whole
// ClaimProvisionTimeout in the very same loop.
err = wait.Poll(time.Second, framework.ClaimProvisionTimeout, func() (bool, error) {
events, err := c.CoreV1().Events(claim.Namespace).List(metav1.ListOptions{})
Expect(err).NotTo(HaveOccurred())
......@@ -853,8 +856,22 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() {
return true, nil
}
}
pvc, err := c.CoreV1().PersistentVolumeClaims(claim.Namespace).Get(claim.Name, metav1.GetOptions{})
if err != nil {
return true, err
}
if pvc.Status.Phase != v1.ClaimPending {
// The PVC was bound to something, i.e. PV was created for wrong KMS key. That's bad!
return true, fmt.Errorf("PVC got unexpectedly %s (to PV %q)", pvc.Status.Phase, pvc.Spec.VolumeName)
}
return false, nil
})
if err == wait.ErrWaitTimeout {
framework.Logf("The test missed event about failed provisioning, but checked that no volume was provisioned for %v", framework.ClaimProvisionTimeout)
err = nil
}
Expect(err).NotTo(HaveOccurred())
})
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment