diff --git a/test/e2e/dynamic_provisioning_test.go b/test/e2e/dynamic_provisioning_test.go index aed3ed4891..8a31050dce 100644 --- a/test/e2e/dynamic_provisioning_test.go +++ b/test/e2e/dynamic_provisioning_test.go @@ -508,6 +508,7 @@ func (t *dynamicProvisioningTestSuite) defineTests(isMultiZone bool) { CSIDriver: testDriver, Volume: volume, StorageClassParameters: map[string]string{"skuName": "Standard_LRS"}, + IsTestingMigration: isTestingMigration, } test.Run(cs, ns) }) diff --git a/test/e2e/testsuites/dynamically_provisioned_resize_volume_tester.go b/test/e2e/testsuites/dynamically_provisioned_resize_volume_tester.go index 87701af003..8a63d734ff 100644 --- a/test/e2e/testsuites/dynamically_provisioned_resize_volume_tester.go +++ b/test/e2e/testsuites/dynamically_provisioned_resize_volume_tester.go @@ -46,6 +46,7 @@ type DynamicallyProvisionedResizeVolumeTest struct { CSIDriver driver.DynamicPVTestDriver StorageClassParameters map[string]string Volume VolumeDetails + IsTestingMigration bool } func (t *DynamicallyProvisionedResizeVolumeTest) Run(client clientset.Interface, namespace *v1.Namespace) { @@ -89,12 +90,18 @@ func (t *DynamicallyProvisionedResizeVolumeTest) Run(client clientset.Interface, ginkgo.By("checking the resizing PV result") newPv, _ := client.CoreV1().PersistentVolumes().Get(context.Background(), newPvc.Spec.VolumeName, metav1.GetOptions{}) newPvSize := newPv.Spec.Capacity["storage"] - if !newSize.Equal(newPvSize) { - framework.Failf("newPVCSize(%+v) is not equal to newPVSize(%+v)", newSize.String(), newPvSize.String()) + if !newSize.Equal(newPvSize) && !t.IsTestingMigration { + ginkgo.By(fmt.Sprintf("newPVCSize(%+v) is not equal to newPVSize(%+v)", newSize.String(), newPvSize.String())) } ginkgo.By("checking the resizing azuredisk result") - diskURI := newPv.Spec.PersistentVolumeSource.CSI.VolumeHandle + var diskURI string + if newPv.Spec.PersistentVolumeSource.CSI != nil { + diskURI = newPv.Spec.PersistentVolumeSource.CSI.VolumeHandle + } else if newPv.Spec.PersistentVolumeSource.AzureDisk != nil { + diskURI = newPv.Spec.PersistentVolumeSource.AzureDisk.DataDiskURI + } + ginkgo.By(fmt.Sprintf("got DiskURI: %v", diskURI)) diskName, err := azuredisk.GetDiskName(diskURI) framework.ExpectNoError(err, fmt.Sprintf("Error getting diskName for azuredisk %v", err)) resourceGroup, err := azuredisk.GetResourceGroupFromURI(diskURI) @@ -111,7 +118,7 @@ func (t *DynamicallyProvisionedResizeVolumeTest) Run(client clientset.Interface, disktest, err := disksClient.Get(context.Background(), resourceGroup, diskName) framework.ExpectNoError(err, fmt.Sprintf("Error getting disk for azuredisk %v", err)) newdiskSize := strconv.Itoa(int(*disktest.DiskSizeGB)) + "Gi" - if !(newSize.String() == newdiskSize) { + if !(newSize.String() == newdiskSize) && !t.IsTestingMigration { framework.Failf("newPVCSize(%+v) is not equal to new azurediskSize(%+v)", newSize.String(), newdiskSize) }