mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 22:33:34 +00:00
e2e test for block volume provisioning
This commit is contained in:
parent
08564f203e
commit
408f62ca4e
@ -57,6 +57,7 @@ type storageClassTest struct {
|
|||||||
pvCheck func(volume *v1.PersistentVolume) error
|
pvCheck func(volume *v1.PersistentVolume) error
|
||||||
nodeName string
|
nodeName string
|
||||||
attach bool
|
attach bool
|
||||||
|
volumeMode *v1.PersistentVolumeMode
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -120,6 +121,10 @@ func testDynamicProvisioning(t storageClassTest, client clientset.Interface, cla
|
|||||||
Expect(pv.Spec.PersistentVolumeReclaimPolicy).To(Equal(*class.ReclaimPolicy))
|
Expect(pv.Spec.PersistentVolumeReclaimPolicy).To(Equal(*class.ReclaimPolicy))
|
||||||
Expect(pv.Spec.MountOptions).To(Equal(class.MountOptions))
|
Expect(pv.Spec.MountOptions).To(Equal(class.MountOptions))
|
||||||
}
|
}
|
||||||
|
if t.volumeMode != nil {
|
||||||
|
Expect(pv.Spec.VolumeMode).NotTo(BeNil())
|
||||||
|
Expect(*pv.Spec.VolumeMode).To(Equal(*t.volumeMode))
|
||||||
|
}
|
||||||
|
|
||||||
// Run the checker
|
// Run the checker
|
||||||
if t.pvCheck != nil {
|
if t.pvCheck != nil {
|
||||||
@ -818,6 +823,34 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() {
|
|||||||
testDynamicProvisioning(test, c, claim, class)
|
testDynamicProvisioning(test, c, claim, class)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Describe("Block volume provisioning [Feature:BlockVolume]", func() {
|
||||||
|
It("should create and delete block persistent volumes", func() {
|
||||||
|
|
||||||
|
// TODO: add openstack once Cinder volume plugin supports block volumes
|
||||||
|
framework.SkipUnlessProviderIs("gce", "aws", "gke", "vsphere", "azure")
|
||||||
|
|
||||||
|
By("creating a claim with default class")
|
||||||
|
block := v1.PersistentVolumeBlock
|
||||||
|
test := storageClassTest{
|
||||||
|
name: "default",
|
||||||
|
claimSize: "2Gi",
|
||||||
|
expectedSize: "2Gi",
|
||||||
|
volumeMode: &block,
|
||||||
|
}
|
||||||
|
// gce or gke
|
||||||
|
if getDefaultPluginName() == "kubernetes.io/gce-pd" {
|
||||||
|
// using GB not GiB as e2e test unit since gce-pd returns GB,
|
||||||
|
// or expectedSize may be greater than claimSize.
|
||||||
|
test.claimSize = "2G"
|
||||||
|
test.expectedSize = "2G"
|
||||||
|
}
|
||||||
|
|
||||||
|
claim := newClaim(test, ns, "default")
|
||||||
|
claim.Spec.VolumeMode = &block
|
||||||
|
testDynamicProvisioning(test, c, claim, nil)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
func getDefaultStorageClassName(c clientset.Interface) string {
|
func getDefaultStorageClassName(c clientset.Interface) string {
|
||||||
|
Loading…
Reference in New Issue
Block a user