mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Use delayed binding for multizone tests
This commit is contained in:
parent
2b9c9154b5
commit
abb2fc656d
@ -77,6 +77,7 @@ var _ = utils.SIGDescribe("Mounted volume expand", func() {
|
|||||||
Name: "default",
|
Name: "default",
|
||||||
ClaimSize: "2Gi",
|
ClaimSize: "2Gi",
|
||||||
AllowVolumeExpansion: true,
|
AllowVolumeExpansion: true,
|
||||||
|
DelayBinding: true,
|
||||||
}
|
}
|
||||||
resizableSc, err = createStorageClass(test, ns, "resizing", c)
|
resizableSc, err = createStorageClass(test, ns, "resizing", c)
|
||||||
Expect(err).NotTo(HaveOccurred(), "Error creating resizable storage class")
|
Expect(err).NotTo(HaveOccurred(), "Error creating resizable storage class")
|
||||||
@ -107,17 +108,22 @@ var _ = utils.SIGDescribe("Mounted volume expand", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("Should verify mounted devices can be resized", func() {
|
It("Should verify mounted devices can be resized", func() {
|
||||||
By("Waiting for PVC to be in bound phase")
|
|
||||||
pvcClaims := []*v1.PersistentVolumeClaim{pvc}
|
pvcClaims := []*v1.PersistentVolumeClaim{pvc}
|
||||||
pvs, err := framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout)
|
|
||||||
Expect(err).NotTo(HaveOccurred(), "Failed waiting for PVC to be bound %v", err)
|
|
||||||
Expect(len(pvs)).To(Equal(1))
|
|
||||||
|
|
||||||
By("Creating a deployment with the provisioned volume")
|
// The reason we use a node selector is because we do not want pod to move to different node when pod is deleted.
|
||||||
|
// Keeping pod on same node reproduces the scenario that volume might already be mounted when resize is attempted.
|
||||||
|
// We should consider adding a unit test that exercises this better.
|
||||||
|
By("Creating a deployment with selected PVC")
|
||||||
deployment, err := framework.CreateDeployment(c, int32(1), map[string]string{"test": "app"}, nodeKeyValueLabel, ns, pvcClaims, "")
|
deployment, err := framework.CreateDeployment(c, int32(1), map[string]string{"test": "app"}, nodeKeyValueLabel, ns, pvcClaims, "")
|
||||||
Expect(err).NotTo(HaveOccurred(), "Failed creating deployment %v", err)
|
Expect(err).NotTo(HaveOccurred(), "Failed creating deployment %v", err)
|
||||||
defer c.AppsV1().Deployments(ns).Delete(deployment.Name, &metav1.DeleteOptions{})
|
defer c.AppsV1().Deployments(ns).Delete(deployment.Name, &metav1.DeleteOptions{})
|
||||||
|
|
||||||
|
// PVC should be bound at this point
|
||||||
|
By("Checking for bound PVC")
|
||||||
|
pvs, err := framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout)
|
||||||
|
Expect(err).NotTo(HaveOccurred(), "Failed waiting for PVC to be bound %v", err)
|
||||||
|
Expect(len(pvs)).To(Equal(1))
|
||||||
|
|
||||||
By("Expanding current pvc")
|
By("Expanding current pvc")
|
||||||
newSize := resource.MustParse("6Gi")
|
newSize := resource.MustParse("6Gi")
|
||||||
pvc, err = expandPVCSize(pvc, newSize, c)
|
pvc, err = expandPVCSize(pvc, newSize, c)
|
||||||
|
Loading…
Reference in New Issue
Block a user