mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
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.
This commit is contained in:
parent
b5040be796
commit
a70bec465d
@ -171,7 +171,6 @@ func skipUnsupportedTest(driver TestDriver, pattern testpatterns.TestPattern) {
|
||||
type VolumeResource struct {
|
||||
Config *PerTestConfig
|
||||
Pattern testpatterns.TestPattern
|
||||
VolType string
|
||||
VolSource *v1.VolumeSource
|
||||
Pvc *v1.PersistentVolumeClaim
|
||||
Pv *v1.PersistentVolume
|
||||
@ -199,7 +198,6 @@ func CreateVolumeResource(driver TestDriver, config *PerTestConfig, pattern test
|
||||
framework.Logf("Creating resource for inline volume")
|
||||
if iDriver, ok := driver.(InlineVolumeTestDriver); ok {
|
||||
r.VolSource = iDriver.GetVolumeSource(false, pattern.FsType, r.Volume)
|
||||
r.VolType = dInfo.Name
|
||||
}
|
||||
case testpatterns.PreprovisionedPV:
|
||||
framework.Logf("Creating resource for pre-provisioned PV")
|
||||
@ -209,7 +207,6 @@ func CreateVolumeResource(driver TestDriver, config *PerTestConfig, pattern test
|
||||
r.Pv, r.Pvc = createPVCPV(f, dInfo.Name, pvSource, volumeNodeAffinity, pattern.VolMode, dInfo.RequiredAccessModes)
|
||||
r.VolSource = createVolumeSource(r.Pvc.Name, false /* readOnly */)
|
||||
}
|
||||
r.VolType = fmt.Sprintf("%s-preprovisionedPV", dInfo.Name)
|
||||
}
|
||||
case testpatterns.DynamicPV:
|
||||
framework.Logf("Creating resource for dynamic PV")
|
||||
@ -238,12 +235,10 @@ func CreateVolumeResource(driver TestDriver, config *PerTestConfig, pattern test
|
||||
f, dInfo.Name, claimSize, r.Sc, pattern.VolMode, dInfo.RequiredAccessModes)
|
||||
r.VolSource = createVolumeSource(r.Pvc.Name, false /* readOnly */)
|
||||
}
|
||||
r.VolType = fmt.Sprintf("%s-dynamicPV", dInfo.Name)
|
||||
}
|
||||
case testpatterns.CSIInlineVolume:
|
||||
framework.Logf("Creating resource for CSI ephemeral inline volume")
|
||||
if eDriver, ok := driver.(EphemeralTestDriver); ok {
|
||||
r.VolType = fmt.Sprintf("%s-ephemeral", dInfo.Name)
|
||||
attributes, _, _ := eDriver.GetVolume(config, 0)
|
||||
r.VolSource = &v1.VolumeSource{
|
||||
CSI: &v1.CSIVolumeSource{
|
||||
|
@ -148,7 +148,7 @@ func (s *subPathTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
|
||||
}
|
||||
|
||||
subPath := f.Namespace.Name
|
||||
l.pod = SubpathTestPod(f, subPath, l.resource.VolType, l.resource.VolSource, true)
|
||||
l.pod = SubpathTestPod(f, subPath, string(volType), l.resource.VolSource, true)
|
||||
l.pod.Spec.NodeName = l.config.ClientNodeName
|
||||
l.pod.Spec.NodeSelector = l.config.ClientNodeSelector
|
||||
|
||||
@ -186,6 +186,8 @@ func (s *subPathTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
|
||||
validateMigrationVolumeOpCounts(f.ClientSet, driver.GetDriverInfo().InTreePluginName, l.intreeOps, l.migratedOps)
|
||||
}
|
||||
|
||||
driverName := driver.GetDriverInfo().Name
|
||||
|
||||
ginkgo.It("should support non-existent path", func() {
|
||||
init()
|
||||
defer cleanup()
|
||||
@ -348,9 +350,9 @@ func (s *subPathTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
|
||||
init()
|
||||
defer cleanup()
|
||||
|
||||
if strings.HasPrefix(l.resource.VolType, "hostPath") || strings.HasPrefix(l.resource.VolType, "csi-hostpath") {
|
||||
if strings.HasPrefix(driverName, "hostPath") {
|
||||
// TODO: This skip should be removed once #61446 is fixed
|
||||
framework.Skipf("%s volume type does not support reconstruction, skipping", l.resource.VolType)
|
||||
framework.Skipf("Driver %s does not support reconstruction, skipping", driverName)
|
||||
}
|
||||
|
||||
testSubpathReconstruction(f, l.hostExec, l.pod, true)
|
||||
@ -390,7 +392,7 @@ func (s *subPathTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
|
||||
init()
|
||||
defer cleanup()
|
||||
if l.roVolSource == nil {
|
||||
framework.Skipf("Volume type %v doesn't support readOnly source", l.resource.VolType)
|
||||
framework.Skipf("Driver %s on volume type %s doesn't support readOnly source", driverName, pattern.VolType)
|
||||
}
|
||||
|
||||
origpod := l.pod.DeepCopy()
|
||||
@ -418,7 +420,7 @@ func (s *subPathTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
|
||||
init()
|
||||
defer cleanup()
|
||||
if l.roVolSource == nil {
|
||||
framework.Skipf("Volume type %v doesn't support readOnly source", l.resource.VolType)
|
||||
framework.Skipf("Driver %s on volume type %s doesn't support readOnly source", driverName, pattern.VolType)
|
||||
}
|
||||
|
||||
// Format the volume while it's writable
|
||||
|
@ -193,7 +193,7 @@ func (t *volumesTestSuite) DefineTests(driver TestDriver, pattern testpatterns.T
|
||||
init()
|
||||
defer cleanup()
|
||||
|
||||
testScriptInPod(f, l.resource.VolType, l.resource.VolSource, l.config)
|
||||
testScriptInPod(f, string(pattern.VolType), l.resource.VolSource, l.config)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user