Skip to content

Commit

Permalink
Merge pull request #478 from andyzhangx/resize-test-failure
Browse files Browse the repository at this point in the history
test: fix in-tree resie e2e test failure
  • Loading branch information
andyzhangx authored Aug 7, 2020
2 parents f6de053 + ed6b5fa commit 64b52c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions test/e2e/dynamic_provisioning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand All @@ -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)
}

Expand Down

0 comments on commit 64b52c8

Please sign in to comment.