Merge pull request #82324 from andyzhangx/fix-azure-pv-e2e-test

test: fix azure disk e2e test failure
This commit is contained in:
Kubernetes Prow Robot
2019-09-11 15:25:53 -07:00
committed by GitHub
3 changed files with 27 additions and 5 deletions

View File

@@ -1440,10 +1440,12 @@ func (a *azureDriver) GetVolumeSource(readOnly bool, fsType string, volume tests
diskName := av.volumeName[(strings.LastIndex(av.volumeName, "/") + 1):]
kind := v1.AzureManagedDisk
volSource := v1.VolumeSource{
AzureDisk: &v1.AzureDiskVolumeSource{
DiskName: diskName,
DataDiskURI: av.volumeName,
Kind: &kind,
ReadOnly: &readOnly,
},
}
@@ -1459,10 +1461,12 @@ func (a *azureDriver) GetPersistentVolumeSource(readOnly bool, fsType string, vo
diskName := av.volumeName[(strings.LastIndex(av.volumeName, "/") + 1):]
kind := v1.AzureManagedDisk
pvSource := v1.PersistentVolumeSource{
AzureDisk: &v1.AzureDiskVolumeSource{
DiskName: diskName,
DataDiskURI: av.volumeName,
Kind: &kind,
ReadOnly: &readOnly,
},
}
@@ -1498,6 +1502,13 @@ func (a *azureDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTestCo
func (a *azureDriver) CreateVolume(config *testsuites.PerTestConfig, volType testpatterns.TestVolType) testsuites.TestVolume {
ginkgo.By("creating a test azure disk volume")
if volType == testpatterns.InlineVolume {
// Volume will be created in framework.TestContext.CloudConfig.Zone zone,
// so pods should be also scheduled there.
config.ClientNodeSelector = map[string]string{
v1.LabelZoneFailureDomain: framework.TestContext.CloudConfig.Zone,
}
}
volumeName, err := framework.CreatePDWithRetry()
framework.ExpectNoError(err)
return &azureVolume{