Merge pull request #97001 from Jiawei0227/copySC

Copy the same storageclass instead of constructing one in external test
This commit is contained in:
Kubernetes Prow Robot 2020-12-08 21:06:07 -08:00 committed by GitHub
commit ae287e848b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 5 deletions

View File

@ -295,7 +295,7 @@ func (d *driverDefinition) GetDynamicProvisionStorageClass(e2econfig *testsuites
// reconsidered if we eventually need to move in-tree storage tests out.
sc.Parameters["csi.storage.k8s.io/fstype"] = fsType
}
return testsuites.GetStorageClass(sc.Provisioner, sc.Parameters, sc.VolumeBindingMode, f.Namespace.Name, "e2e-sc")
return testsuites.CopyStorageClass(sc, f.Namespace.Name, "e2e-sc")
}
func (d *driverDefinition) GetTimeouts() *framework.TimeoutContext {

View File

@ -243,9 +243,7 @@ func CreateVolumeResource(driver TestDriver, config *PerTestConfig, pattern test
if pattern.BindingMode != "" {
r.Sc.VolumeBindingMode = &pattern.BindingMode
}
if pattern.AllowExpansion != false {
r.Sc.AllowVolumeExpansion = &pattern.AllowExpansion
}
ginkgo.By("creating a StorageClass " + r.Sc.Name)

View File

@ -54,6 +54,16 @@ func CreateVolume(driver TestDriver, config *PerTestConfig, volType testpatterns
return nil
}
// CopyStorageClass constructs a new StorageClass instance
// with a unique name that is based on namespace + suffix
// using the same storageclass setting from the parameter
func CopyStorageClass(sc *storagev1.StorageClass, ns string, suffix string) *storagev1.StorageClass {
copy := sc.DeepCopy()
copy.ObjectMeta.Name = names.SimpleNameGenerator.GenerateName(ns + "-" + suffix)
copy.ResourceVersion = ""
return copy
}
// GetStorageClass constructs a new StorageClass instance
// with a unique name that is based on namespace + suffix.
func GetStorageClass(

View File

@ -156,7 +156,9 @@ func (v *volumeExpandTestSuite) DefineTests(driver TestDriver, pattern testpatte
defer cleanup()
var err error
gomega.Expect(l.resource.Sc.AllowVolumeExpansion).To(gomega.BeNil())
gomega.Expect(l.resource.Sc.AllowVolumeExpansion).NotTo(gomega.BeNil())
allowVolumeExpansion := *l.resource.Sc.AllowVolumeExpansion
gomega.Expect(allowVolumeExpansion).To(gomega.BeFalse())
ginkgo.By("Expanding non-expandable pvc")
currentPvcSize := l.resource.Pvc.Spec.Resources.Requests[v1.ResourceStorage]
newSize := currentPvcSize.DeepCopy()