mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Fix test for provisioning in unmanaged zone.
defer evaluates arguments of the deferred function immediately, so it actually deleted a storage class and a claim before the test could do anything useful. The test passed just accidentally, as the test is expected to time out. It timed out from wrong reasons though.
This commit is contained in:
parent
a845e3e936
commit
a569b14ee3
@ -201,13 +201,18 @@ var _ = framework.KubeDescribe("Dynamic provisioning", func() {
|
||||
sc, err = c.StorageV1().StorageClasses().Create(sc)
|
||||
defer Expect(c.StorageV1().StorageClasses().Delete(sc.Name, nil)).To(Succeed())
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
defer func() {
|
||||
Expect(c.StorageV1().StorageClasses().Delete(sc.Name, nil)).To(Succeed())
|
||||
}()
|
||||
|
||||
By("Creating a claim and expecting it to timeout")
|
||||
pvc := newClaim(ns)
|
||||
pvc.Spec.StorageClassName = &sc.Name
|
||||
pvc, err = c.Core().PersistentVolumeClaims(ns).Create(pvc)
|
||||
defer Expect(c.Core().PersistentVolumeClaims(ns).Delete(pvc.Name, nil)).To(Succeed())
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
defer func() {
|
||||
Expect(c.Core().PersistentVolumeClaims(ns).Delete(pvc.Name, nil)).To(Succeed())
|
||||
}()
|
||||
|
||||
// The claim should timeout phase:Pending
|
||||
err = framework.WaitForPersistentVolumeClaimPhase(v1.ClaimBound, c, ns, pvc.Name, 2*time.Second, framework.ClaimProvisionTimeout)
|
||||
|
Loading…
Reference in New Issue
Block a user