e2e storage: read/write + read-only ephemeral inline volume test, data sharing
The assumption so far was that all drivers support read/write volumes. That might not necessarily be true, so we have to let the test driver specify it and then test accordingly. Another aspect that is worth testing is whether the driver correctly creates a new volume for each pod even if the volume attributes are the same. However, drivers are not required to do that, so again we have to let the test driver specify that.
This commit is contained in:
30
test/e2e/storage/external/external.go
vendored
30
test/e2e/storage/external/external.go
vendored
@@ -179,14 +179,25 @@ type driverDefinition struct {
|
||||
// TODO (?): load from file
|
||||
}
|
||||
|
||||
// InlineVolumeAttributes defines one or more set of attributes for
|
||||
// use as inline ephemeral volumes. At least one set of attributes
|
||||
// has to be defined to enable testing of inline ephemeral volumes.
|
||||
// If a test needs more volumes than defined, some of the defined
|
||||
// InlineVolumes defines one or more volumes for use as inline
|
||||
// ephemeral volumes. At least one such volume has to be
|
||||
// defined to enable testing of inline ephemeral volumes. If
|
||||
// a test needs more volumes than defined, some of the defined
|
||||
// volumes will be used multiple times.
|
||||
//
|
||||
// DriverInfo.Name is used as name of the driver in the inline volume.
|
||||
InlineVolumeAttributes []map[string]string
|
||||
InlineVolumes []struct {
|
||||
// Attributes are passed as NodePublishVolumeReq.volume_context.
|
||||
// Can be empty.
|
||||
Attributes map[string]string
|
||||
// Shared defines whether the resulting volume is
|
||||
// shared between different pods (i.e. changes made
|
||||
// in one pod are visible in another)
|
||||
Shared bool
|
||||
// ReadOnly must be set to true if the driver does not
|
||||
// support mounting as read/write.
|
||||
ReadOnly bool
|
||||
}
|
||||
|
||||
// ClaimSize defines the desired size of dynamically
|
||||
// provisioned volumes. Default is "5GiB".
|
||||
@@ -221,7 +232,7 @@ func (d *driverDefinition) SkipUnsupportedTest(pattern testpatterns.TestPattern)
|
||||
supported = true
|
||||
}
|
||||
case testpatterns.CSIInlineVolume:
|
||||
supported = len(d.InlineVolumeAttributes) != 0
|
||||
supported = len(d.InlineVolumes) != 0
|
||||
}
|
||||
if !supported {
|
||||
framework.Skipf("Driver %q does not support volume type %q - skipping", d.DriverInfo.Name, pattern.VolType)
|
||||
@@ -294,11 +305,12 @@ func (d *driverDefinition) GetClaimSize() string {
|
||||
return d.ClaimSize
|
||||
}
|
||||
|
||||
func (d *driverDefinition) GetVolumeAttributes(config *testsuites.PerTestConfig, volumeNumber int) map[string]string {
|
||||
if len(d.InlineVolumeAttributes) == 0 {
|
||||
func (d *driverDefinition) GetVolume(config *testsuites.PerTestConfig, volumeNumber int) (map[string]string, bool, bool) {
|
||||
if len(d.InlineVolumes) == 0 {
|
||||
framework.Skipf("%s does not have any InlineVolumeAttributes defined", d.DriverInfo.Name)
|
||||
}
|
||||
return d.InlineVolumeAttributes[volumeNumber%len(d.InlineVolumeAttributes)]
|
||||
volume := d.InlineVolumes[volumeNumber%len(d.InlineVolumes)]
|
||||
return volume.Attributes, volume.Shared, volume.ReadOnly
|
||||
}
|
||||
|
||||
func (d *driverDefinition) GetCSIDriverName(config *testsuites.PerTestConfig) string {
|
||||
|
||||
Reference in New Issue
Block a user