mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
e2e: use k8sVersionGreaterEquals() for rbd tests
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
c4289f01e8
commit
d26030ca5f
43
e2e/rbd.go
43
e2e/rbd.go
@ -357,16 +357,12 @@ var _ = Describe("RBD", func() {
|
||||
})
|
||||
|
||||
By("create a PVC clone and bind it to an app", func() {
|
||||
v, err := f.ClientSet.Discovery().ServerVersion()
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to get server version with error with error %v", err)
|
||||
}
|
||||
// snapshot beta is only supported from v1.17+
|
||||
if v.Major > "1" || (v.Major == "1" && v.Minor >= "17") {
|
||||
if k8sVersionGreaterEquals(f.ClientSet, 1, 17) {
|
||||
var wg sync.WaitGroup
|
||||
totalCount := 10
|
||||
wg.Add(totalCount)
|
||||
err = createRBDSnapshotClass(f)
|
||||
err := createRBDSnapshotClass(f)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to create storageclass with error %v", err)
|
||||
}
|
||||
@ -511,12 +507,8 @@ var _ = Describe("RBD", func() {
|
||||
})
|
||||
|
||||
By("create a PVC-PVC clone and bind it to an app", func() {
|
||||
v, err := f.ClientSet.Discovery().ServerVersion()
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to get server version with error %v", err)
|
||||
}
|
||||
// pvc clone is only supported from v1.16+
|
||||
if v.Major > "1" || (v.Major == "1" && v.Minor >= "16") {
|
||||
if k8sVersionGreaterEquals(f.ClientSet, 1, 16) {
|
||||
validatePVCClone(pvcPath, pvcSmartClonePath, appSmartClonePath, f)
|
||||
}
|
||||
|
||||
@ -586,13 +578,8 @@ var _ = Describe("RBD", func() {
|
||||
})
|
||||
|
||||
By("Resize Filesystem PVC and check application directory size", func() {
|
||||
v, err := f.ClientSet.Discovery().ServerVersion()
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to get server version with error with error %v", err)
|
||||
}
|
||||
|
||||
// Resize 0.3.0 is only supported from v1.15+
|
||||
if v.Major > "1" || (v.Major == "1" && v.Minor >= "15") {
|
||||
if k8sVersionGreaterEquals(f.ClientSet, 1, 15) {
|
||||
err := resizePVCAndValidateSize(pvcPath, appPath, f)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to resize filesystem PVC %v", err)
|
||||
@ -617,13 +604,8 @@ var _ = Describe("RBD", func() {
|
||||
})
|
||||
|
||||
By("Resize Block PVC and check Device size", func() {
|
||||
v, err := f.ClientSet.Discovery().ServerVersion()
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to get server version with error with error %v", err)
|
||||
}
|
||||
|
||||
// Block PVC resize is supported in kubernetes 1.16+
|
||||
if v.Major > "1" || (v.Major == "1" && v.Minor >= "16") {
|
||||
if k8sVersionGreaterEquals(f.ClientSet, 1, 16) {
|
||||
err := resizePVCAndValidateSize(rawPvcPath, rawAppPath, f)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to resize block PVC with error %v", err)
|
||||
@ -920,12 +902,8 @@ var _ = Describe("RBD", func() {
|
||||
})
|
||||
|
||||
By("create ROX PVC clone and mount it to multiple pods", func() {
|
||||
v, err := f.ClientSet.Discovery().ServerVersion()
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to get server version with error %v", err)
|
||||
}
|
||||
// snapshot beta is only supported from v1.17+
|
||||
if v.Major > "1" || (v.Major == "1" && v.Minor >= "17") {
|
||||
if k8sVersionGreaterEquals(f.ClientSet, 1, 17) {
|
||||
// create PVC and bind it to an app
|
||||
pvc, err := loadPVC(pvcPath)
|
||||
if err != nil {
|
||||
@ -1084,14 +1062,9 @@ var _ = Describe("RBD", func() {
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to validate pvc and application binding with error %v", err)
|
||||
}
|
||||
v, err := f.ClientSet.Discovery().ServerVersion()
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to get server version with error with error %v", err)
|
||||
}
|
||||
|
||||
// Resize Block PVC and check Device size within the namespace
|
||||
// Block PVC resize is supported in kubernetes 1.16+
|
||||
if v.Major > "1" || (v.Major == "1" && v.Minor >= "16") {
|
||||
if k8sVersionGreaterEquals(f.ClientSet, 1, 16) {
|
||||
err = resizePVCAndValidateSize(rawPvcPath, rawAppPath, f)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to resize block PVC with error %v", err)
|
||||
@ -1100,7 +1073,7 @@ var _ = Describe("RBD", func() {
|
||||
|
||||
// Create a PVC clone and bind it to an app within the namespace
|
||||
// snapshot beta is only supported from v1.17+
|
||||
if v.Major > "1" || (v.Major == "1" && v.Minor >= "17") {
|
||||
if k8sVersionGreaterEquals(f.ClientSet, 1, 17) {
|
||||
pvc, err := loadPVC(pvcPath)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to load PVC with error %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user