Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Commit ff531cb

Browse files
pohlyokartau
authored andcommitted
e2e: fix and extend CSI ephemeral volume sanity tests
The idempotency tests didn't really call the NodePublishVolume call multiple time. Instead they stopped after the first successful call due to a misplaced "break". It's worth testing the default FS, ext4 and XFS separately because code paths and idempotency handling might be different.
1 parent 38c42b0 commit ff531cb

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

test/e2e/storage/sanity.go

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -762,11 +762,11 @@ fi
762762
v.remove(vol, volName)
763763
})
764764

765-
Context("ephemeral volumes", func() {
766-
doit := func(withFlag bool, repeatCalls int) {
765+
Context("CSI ephemeral volumes", func() {
766+
doit := func(withFlag bool, repeatCalls int, fsType string) {
767767
targetPath := sc.TargetPath + "/ephemeral"
768768
params := map[string]string{
769-
"size": "1Mi",
769+
"size": "100Mi",
770770
}
771771
if withFlag {
772772
params["csi.storage.k8s.io/ephemeral"] = "true"
@@ -776,7 +776,9 @@ fi
776776
VolumeContext: params,
777777
VolumeCapability: &csi.VolumeCapability{
778778
AccessType: &csi.VolumeCapability_Mount{
779-
Mount: &csi.VolumeCapability_MountVolume{},
779+
Mount: &csi.VolumeCapability_MountVolume{
780+
FsType: fsType,
781+
},
780782
},
781783
AccessMode: &csi.VolumeCapability_AccessMode{
782784
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
@@ -790,7 +792,6 @@ fi
790792
_, err := nc.NodePublishVolume(ctx, &req)
791793
if err == nil {
792794
published = true
793-
break
794795
} else if failedPublish == nil {
795796
failedPublish = fmt.Errorf("NodePublishVolume for ephemeral volume, attempt #%d: %v", i, err)
796797
}
@@ -812,13 +813,21 @@ fi
812813
}
813814

814815
doall := func(withFlag bool) {
815-
It("work", func() {
816-
doit(withFlag, 1)
817-
})
816+
for _, fs := range []string{"default", "ext4", "xfs"} {
817+
fsType := fs
818+
if fsType == "default" {
819+
fsType = ""
820+
}
821+
Context(fs+" FS", func() {
822+
It("work", func() {
823+
doit(withFlag, 1, fsType)
824+
})
818825

819-
It("are idempotent", func() {
820-
doit(withFlag, 10)
821-
})
826+
It("are idempotent", func() {
827+
doit(withFlag, 10, fsType)
828+
})
829+
})
830+
}
822831
}
823832

824833
Context("with csi.storage.k8s.io/ephemeral", func() {

0 commit comments

Comments
 (0)