Skip to content

Commit a70bec4

Browse files
committed
e2e: support long CSI driver names
The storage e2e test suite uses given CSI driver names as pod names. For pod names that also get enriched by a prefix and suffix, it is very easy to exceed the 63 character limit that pod names are subject to, thereby causing tests to fail. This change fixes the described problem by omitting the driver name from the pod name suffix. It also allows us to drop VolumeResource.VolType.
1 parent b5040be commit a70bec4

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

test/e2e/storage/testsuites/base.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ func skipUnsupportedTest(driver TestDriver, pattern testpatterns.TestPattern) {
171171
type VolumeResource struct {
172172
Config *PerTestConfig
173173
Pattern testpatterns.TestPattern
174-
VolType string
175174
VolSource *v1.VolumeSource
176175
Pvc *v1.PersistentVolumeClaim
177176
Pv *v1.PersistentVolume
@@ -199,7 +198,6 @@ func CreateVolumeResource(driver TestDriver, config *PerTestConfig, pattern test
199198
framework.Logf("Creating resource for inline volume")
200199
if iDriver, ok := driver.(InlineVolumeTestDriver); ok {
201200
r.VolSource = iDriver.GetVolumeSource(false, pattern.FsType, r.Volume)
202-
r.VolType = dInfo.Name
203201
}
204202
case testpatterns.PreprovisionedPV:
205203
framework.Logf("Creating resource for pre-provisioned PV")
@@ -209,7 +207,6 @@ func CreateVolumeResource(driver TestDriver, config *PerTestConfig, pattern test
209207
r.Pv, r.Pvc = createPVCPV(f, dInfo.Name, pvSource, volumeNodeAffinity, pattern.VolMode, dInfo.RequiredAccessModes)
210208
r.VolSource = createVolumeSource(r.Pvc.Name, false /* readOnly */)
211209
}
212-
r.VolType = fmt.Sprintf("%s-preprovisionedPV", dInfo.Name)
213210
}
214211
case testpatterns.DynamicPV:
215212
framework.Logf("Creating resource for dynamic PV")
@@ -238,12 +235,10 @@ func CreateVolumeResource(driver TestDriver, config *PerTestConfig, pattern test
238235
f, dInfo.Name, claimSize, r.Sc, pattern.VolMode, dInfo.RequiredAccessModes)
239236
r.VolSource = createVolumeSource(r.Pvc.Name, false /* readOnly */)
240237
}
241-
r.VolType = fmt.Sprintf("%s-dynamicPV", dInfo.Name)
242238
}
243239
case testpatterns.CSIInlineVolume:
244240
framework.Logf("Creating resource for CSI ephemeral inline volume")
245241
if eDriver, ok := driver.(EphemeralTestDriver); ok {
246-
r.VolType = fmt.Sprintf("%s-ephemeral", dInfo.Name)
247242
attributes, _, _ := eDriver.GetVolume(config, 0)
248243
r.VolSource = &v1.VolumeSource{
249244
CSI: &v1.CSIVolumeSource{

test/e2e/storage/testsuites/subpath.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (s *subPathTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
148148
}
149149

150150
subPath := f.Namespace.Name
151-
l.pod = SubpathTestPod(f, subPath, l.resource.VolType, l.resource.VolSource, true)
151+
l.pod = SubpathTestPod(f, subPath, string(volType), l.resource.VolSource, true)
152152
l.pod.Spec.NodeName = l.config.ClientNodeName
153153
l.pod.Spec.NodeSelector = l.config.ClientNodeSelector
154154

@@ -186,6 +186,8 @@ func (s *subPathTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
186186
validateMigrationVolumeOpCounts(f.ClientSet, driver.GetDriverInfo().InTreePluginName, l.intreeOps, l.migratedOps)
187187
}
188188

189+
driverName := driver.GetDriverInfo().Name
190+
189191
ginkgo.It("should support non-existent path", func() {
190192
init()
191193
defer cleanup()
@@ -348,9 +350,9 @@ func (s *subPathTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
348350
init()
349351
defer cleanup()
350352

351-
if strings.HasPrefix(l.resource.VolType, "hostPath") || strings.HasPrefix(l.resource.VolType, "csi-hostpath") {
353+
if strings.HasPrefix(driverName, "hostPath") {
352354
// TODO: This skip should be removed once #61446 is fixed
353-
framework.Skipf("%s volume type does not support reconstruction, skipping", l.resource.VolType)
355+
framework.Skipf("Driver %s does not support reconstruction, skipping", driverName)
354356
}
355357

356358
testSubpathReconstruction(f, l.hostExec, l.pod, true)
@@ -390,7 +392,7 @@ func (s *subPathTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
390392
init()
391393
defer cleanup()
392394
if l.roVolSource == nil {
393-
framework.Skipf("Volume type %v doesn't support readOnly source", l.resource.VolType)
395+
framework.Skipf("Driver %s on volume type %s doesn't support readOnly source", driverName, pattern.VolType)
394396
}
395397

396398
origpod := l.pod.DeepCopy()
@@ -418,7 +420,7 @@ func (s *subPathTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
418420
init()
419421
defer cleanup()
420422
if l.roVolSource == nil {
421-
framework.Skipf("Volume type %v doesn't support readOnly source", l.resource.VolType)
423+
framework.Skipf("Driver %s on volume type %s doesn't support readOnly source", driverName, pattern.VolType)
422424
}
423425

424426
// Format the volume while it's writable

test/e2e/storage/testsuites/volumes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func (t *volumesTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
193193
init()
194194
defer cleanup()
195195

196-
testScriptInPod(f, l.resource.VolType, l.resource.VolSource, l.config)
196+
testScriptInPod(f, string(pattern.VolType), l.resource.VolSource, l.config)
197197
})
198198
}
199199
}

0 commit comments

Comments
 (0)