From 67926c3777ca5f53aa6b8b556eb30e3783433b04 Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Tue, 30 Jan 2024 17:33:11 +0100 Subject: [PATCH] Update in-tree vSphere tests Don't implement interfaces that trigger tests with in-line and pre-provisioned vSphere volumes. With cloud provider removal, the in-tree vSphere tests won't be able to create a volume in vSphere and thus test in-line volumes in Pods and pre-provisioned PVs. Only dynamically provisioned volumes can be used for testing, because they're provisioned by the vSphere CSI driver. --- test/e2e/storage/drivers/in_tree.go | 59 +---------------------------- 1 file changed, 1 insertion(+), 58 deletions(-) diff --git a/test/e2e/storage/drivers/in_tree.go b/test/e2e/storage/drivers/in_tree.go index 493789b0204..192954591e6 100644 --- a/test/e2e/storage/drivers/in_tree.go +++ b/test/e2e/storage/drivers/in_tree.go @@ -1182,14 +1182,7 @@ type vSphereDriver struct { driverInfo storageframework.DriverInfo } -type vSphereVolume struct { - volumePath string -} - var _ storageframework.TestDriver = &vSphereDriver{} -var _ storageframework.PreprovisionedVolumeTestDriver = &vSphereDriver{} -var _ storageframework.InlineVolumeTestDriver = &vSphereDriver{} -var _ storageframework.PreprovisionedPVTestDriver = &vSphereDriver{} var _ storageframework.DynamicPVTestDriver = &vSphereDriver{} // InitVSphereDriver returns vSphereDriver that implements TestDriver interface @@ -1220,6 +1213,7 @@ func InitVSphereDriver() storageframework.TestDriver { }, } } + func (v *vSphereDriver) GetDriverInfo() *storageframework.DriverInfo { return &v.driverInfo } @@ -1228,50 +1222,6 @@ func (v *vSphereDriver) SkipUnsupportedTest(pattern storageframework.TestPattern e2eskipper.SkipUnlessProviderIs("vsphere") } -func (v *vSphereDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource { - vsv, ok := e2evolume.(*vSphereVolume) - if !ok { - framework.Failf("Failed to cast test volume of type %T to the cSphere test volume", e2evolume) - } - - // vSphere driver doesn't seem to support readOnly volume - // TODO: check if it is correct - if readOnly { - return nil - } - volSource := v1.VolumeSource{ - VsphereVolume: &v1.VsphereVirtualDiskVolumeSource{ - VolumePath: vsv.volumePath, - }, - } - if fsType != "" { - volSource.VsphereVolume.FSType = fsType - } - return &volSource -} - -func (v *vSphereDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) { - vsv, ok := e2evolume.(*vSphereVolume) - if !ok { - framework.Failf("Failed to cast test volume of type %T to the vSphere test volume", e2evolume) - } - - // vSphere driver doesn't seem to support readOnly volume - // TODO: check if it is correct - if readOnly { - return nil, nil - } - pvSource := v1.PersistentVolumeSource{ - VsphereVolume: &v1.VsphereVirtualDiskVolumeSource{ - VolumePath: vsv.volumePath, - }, - } - if fsType != "" { - pvSource.VsphereVolume.FSType = fsType - } - return &pvSource, nil -} - func (v *vSphereDriver) GetDynamicProvisionStorageClass(ctx context.Context, config *storageframework.PerTestConfig, fsType string) *storagev1.StorageClass { provisioner := "kubernetes.io/vsphere-volume" parameters := map[string]string{} @@ -1291,13 +1241,6 @@ func (v *vSphereDriver) PrepareTest(ctx context.Context, f *framework.Framework) } } -func (v *vSphereDriver) CreateVolume(ctx context.Context, config *storageframework.PerTestConfig, volType storageframework.TestVolType) storageframework.TestVolume { - return &vSphereVolume{} -} - -func (v *vSphereVolume) DeleteVolume(ctx context.Context) { -} - // Azure Disk type azureDiskDriver struct { driverInfo storageframework.DriverInfo