mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #97001 from Jiawei0227/copySC
Copy the same storageclass instead of constructing one in external test
This commit is contained in:
commit
ae287e848b
2
test/e2e/storage/external/external.go
vendored
2
test/e2e/storage/external/external.go
vendored
@ -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 {
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user