mirror of https://github.com/k3s-io/k3s
e2e/storage: ensure that also external storage classes are unique
One previously undocumented expectation is that GetDynamicProvisionStorageClass can be called more than once per test and then each time returns a new, unique storage class. The in-memory implementation in driveroperations.go:GetStorageClass ensured that, but loading from a .yaml file didn't. This caused the multivolume tests to fail when applied to an already installed GCE driver with the -storage.testdriver parameter.k3s-v1.15.3
parent
62c5c6345e
commit
093027c891
|
@ -11,6 +11,7 @@ go_library(
|
|||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/storage/names:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
|
||||
"//test/e2e/framework:go_default_library",
|
||||
"//test/e2e/storage/testpatterns:go_default_library",
|
||||
|
|
|
@ -27,6 +27,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apiserver/pkg/storage/names"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
"k8s.io/kubernetes/test/e2e/storage/testpatterns"
|
||||
|
@ -242,6 +243,9 @@ func (d *driverDefinition) GetDynamicProvisionStorageClass(config *testsuites.Pe
|
|||
|
||||
sc, ok := items[0].(*storagev1.StorageClass)
|
||||
gomega.Expect(ok).To(gomega.BeTrue(), "storage class from %s", d.StorageClass.FromFile)
|
||||
// Ensure that we can load more than once as required for
|
||||
// GetDynamicProvisionStorageClass by adding a random suffix.
|
||||
sc.Name = names.SimpleNameGenerator.GenerateName(sc.Name + "-")
|
||||
if fsType != "" {
|
||||
if sc.Parameters == nil {
|
||||
sc.Parameters = map[string]string{}
|
||||
|
|
|
@ -88,6 +88,9 @@ type PreprovisionedPVTestDriver interface {
|
|||
type DynamicPVTestDriver interface {
|
||||
TestDriver
|
||||
// GetDynamicProvisionStorageClass returns a StorageClass dynamic provision Persistent Volume.
|
||||
// The StorageClass must be created in the current test's namespace and have
|
||||
// a unique name inside that namespace because GetDynamicProvisionStorageClass might
|
||||
// be called more than once per test.
|
||||
// It will set fsType to the StorageClass, if TestDriver supports it.
|
||||
// It will return nil, if the TestDriver doesn't support it.
|
||||
GetDynamicProvisionStorageClass(config *PerTestConfig, fsType string) *storagev1.StorageClass
|
||||
|
|
Loading…
Reference in New Issue