Skip to content

Commit 5ed3164

Browse files
committed
Update in-tree gcePersistentDisk tests
1 parent 8b1fe81 commit 5ed3164

File tree

1 file changed

+0
-83
lines changed

1 file changed

+0
-83
lines changed

test/e2e/storage/drivers/in_tree.go

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ import (
5757
e2eauth "k8s.io/kubernetes/test/e2e/framework/auth"
5858
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
5959
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
60-
e2epv "k8s.io/kubernetes/test/e2e/framework/pv"
6160
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
6261
e2evolume "k8s.io/kubernetes/test/e2e/framework/volume"
6362
storageframework "k8s.io/kubernetes/test/e2e/storage/framework"
@@ -802,14 +801,7 @@ type gcePdDriver struct {
802801
driverInfo storageframework.DriverInfo
803802
}
804803

805-
type gcePdVolume struct {
806-
volumeName string
807-
}
808-
809804
var _ storageframework.TestDriver = &gcePdDriver{}
810-
var _ storageframework.PreprovisionedVolumeTestDriver = &gcePdDriver{}
811-
var _ storageframework.InlineVolumeTestDriver = &gcePdDriver{}
812-
var _ storageframework.PreprovisionedPVTestDriver = &gcePdDriver{}
813805
var _ storageframework.DynamicPVTestDriver = &gcePdDriver{}
814806

815807
// InitGcePdDriver returns gcePdDriver that implements TestDriver interface
@@ -898,40 +890,6 @@ func (g *gcePdDriver) SkipUnsupportedTest(pattern storageframework.TestPattern)
898890
}
899891
}
900892

901-
func (g *gcePdDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource {
902-
gv, ok := e2evolume.(*gcePdVolume)
903-
if !ok {
904-
framework.Failf("Failed to cast test volume of type %T to the GCE PD test volume", e2evolume)
905-
}
906-
volSource := v1.VolumeSource{
907-
GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{
908-
PDName: gv.volumeName,
909-
ReadOnly: readOnly,
910-
},
911-
}
912-
if fsType != "" {
913-
volSource.GCEPersistentDisk.FSType = fsType
914-
}
915-
return &volSource
916-
}
917-
918-
func (g *gcePdDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) {
919-
gv, ok := e2evolume.(*gcePdVolume)
920-
if !ok {
921-
framework.Failf("Failed to cast test volume of type %T to the GCE PD test volume", e2evolume)
922-
}
923-
pvSource := v1.PersistentVolumeSource{
924-
GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{
925-
PDName: gv.volumeName,
926-
ReadOnly: readOnly,
927-
},
928-
}
929-
if fsType != "" {
930-
pvSource.GCEPersistentDisk.FSType = fsType
931-
}
932-
return &pvSource, nil
933-
}
934-
935893
func (g *gcePdDriver) GetDynamicProvisionStorageClass(ctx context.Context, config *storageframework.PerTestConfig, fsType string) *storagev1.StorageClass {
936894
provisioner := "kubernetes.io/gce-pd"
937895
parameters := map[string]string{}
@@ -962,29 +920,6 @@ func (g *gcePdDriver) PrepareTest(ctx context.Context, f *framework.Framework) *
962920

963921
}
964922

965-
func (g *gcePdDriver) CreateVolume(ctx context.Context, config *storageframework.PerTestConfig, volType storageframework.TestVolType) storageframework.TestVolume {
966-
zone := getInlineVolumeZone(ctx, config.Framework)
967-
if volType == storageframework.InlineVolume {
968-
// PD will be created in framework.TestContext.CloudConfig.Zone zone,
969-
// so pods should be also scheduled there.
970-
config.ClientNodeSelection = e2epod.NodeSelection{
971-
Selector: map[string]string{
972-
v1.LabelTopologyZone: zone,
973-
},
974-
}
975-
}
976-
ginkgo.By("creating a test gce pd volume")
977-
vname, err := e2epv.CreatePDWithRetryAndZone(ctx, zone)
978-
framework.ExpectNoError(err)
979-
return &gcePdVolume{
980-
volumeName: vname,
981-
}
982-
}
983-
984-
func (v *gcePdVolume) DeleteVolume(ctx context.Context) {
985-
_ = e2epv.DeletePDWithRetry(ctx, v.volumeName)
986-
}
987-
988923
// vSphere
989924
type vSphereDriver struct {
990925
driverInfo storageframework.DriverInfo
@@ -1437,24 +1372,6 @@ func cleanUpVolumeServer(ctx context.Context, f *framework.Framework, serverPod
14371372
cleanUpVolumeServerWithSecret(ctx, f, serverPod, nil)
14381373
}
14391374

1440-
func getInlineVolumeZone(ctx context.Context, f *framework.Framework) string {
1441-
if framework.TestContext.CloudConfig.Zone != "" {
1442-
return framework.TestContext.CloudConfig.Zone
1443-
}
1444-
// if zone is not specified we will randomly pick a zone from schedulable nodes for inline tests
1445-
node, err := e2enode.GetRandomReadySchedulableNode(ctx, f.ClientSet)
1446-
framework.ExpectNoError(err)
1447-
zone, ok := node.Labels[v1.LabelFailureDomainBetaZone]
1448-
if ok {
1449-
return zone
1450-
}
1451-
topologyZone, ok := node.Labels[v1.LabelTopologyZone]
1452-
if ok {
1453-
return topologyZone
1454-
}
1455-
return ""
1456-
}
1457-
14581375
// cleanUpVolumeServerWithSecret is a wrapper of cleanup function for volume server with secret created by specific CreateStorageServer function.
14591376
func cleanUpVolumeServerWithSecret(ctx context.Context, f *framework.Framework, serverPod *v1.Pod, secret *v1.Secret) {
14601377
cs := f.ClientSet

0 commit comments

Comments
 (0)