This repository has been archived by the owner on Oct 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refact(tests): add resize and remount tests for jiva volumes (#32)
- add resize tests - add remount tests - bump k8s version 1.18.1 Signed-off-by: Payes Anand <[email protected]>
- Loading branch information
Showing
6 changed files
with
338 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
Copyright 2020 The OpenEBS Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package volume | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
) | ||
|
||
var _ = Describe("[csi] [jiva] TEST PVC CREATION DELETION WITHOUT APP", func() { | ||
BeforeEach(preparePVCCreationDeletionWithoutAppTest) | ||
AfterEach(cleanupAfterPVCCreationDeletionWithoutAppTest) | ||
|
||
Context("PVC is created and deleted", func() { | ||
It("Should run PVC creation and deletion test", pvcCreationDeletionWithoutAppTest) | ||
}) | ||
}) | ||
|
||
func pvcCreationDeletionWithoutAppTest() { | ||
By("creating and verifying PVC bound status", createAndVerifyPVC) | ||
By("should verify jivaVolumeCR has been created", func() { verifyJivaVolumeCRCreated() }) | ||
By("Deleting pvc", deletePVC) | ||
By("should verify jivaVolumeCR has been deleted", func() { verifyJivaVolumeCRDeleted() }) | ||
} | ||
|
||
func preparePVCCreationDeletionWithoutAppTest() { | ||
By("Creating storage class", createStorageClass) | ||
} | ||
|
||
func cleanupAfterPVCCreationDeletionWithoutAppTest() { | ||
By("Deleting storage class", deleteStorageClass) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
Copyright 2020 The OpenEBS Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package volume | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
) | ||
|
||
var _ = Describe("[csi] [jiva] TEST Remount when volume goes into RO mode", func() { | ||
BeforeEach(prepareForRemountTest) | ||
AfterEach(cleanupAfterRemountTest) | ||
|
||
Context("App is deployed and restarted on pvc with replica count 1", func() { | ||
It("Should run Volume Creation Test", remountTest) | ||
}) | ||
}) | ||
|
||
func remountTest() { | ||
By("creating and verifying PVC bound status", createAndVerifyPVC) | ||
By("Creating and deploying app pod", createDeployVerifyApp) | ||
By("scale down jiva controller pod", scaleDownControllerPod) | ||
By("Verify app state as CrashLoopBackOff", func() { verifyCrashLoopBackOffStateOfAppPod(true) }) | ||
By("Scale up jiva controller pod", scaleUpControllerPod) | ||
By("Verify app state as not CrashLoopBackOff", func() { verifyCrashLoopBackOffStateOfAppPod(false) }) | ||
By("Deleting application deployment", deleteAppDeployment) | ||
By("Deleting pvc", deletePVC) | ||
} | ||
|
||
func prepareForRemountTest() { | ||
By("Creating storage class", createStorageClass) | ||
} | ||
|
||
func cleanupAfterRemountTest() { | ||
By("Deleting storage class", deleteStorageClass) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
Copyright 2019 The OpenEBS Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package volume | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
"fmt" | ||
) | ||
|
||
var _ = Describe("[csi] [jiva] TEST VOLUME RESIZE", func() { | ||
BeforeEach(prepareForVolumeResizeTest) | ||
AfterEach(cleanupAfterVolumeResizeTest) | ||
|
||
Context("App is deployed with volume replica count 1 and pvc is resized", func() { | ||
It("Should run Volume Resize Test", volumeResizeTest) | ||
}) | ||
}) | ||
|
||
func volumeResizeTest() { | ||
currentK8sVersion := getCurrentK8sMinorVersion() | ||
if currentK8sVersion < 16 { | ||
fmt.Printf( | ||
"resizing is not supported on Kubernetes version: 1.%d. Min supported version is 1.16\n", | ||
currentK8sVersion, | ||
) | ||
return | ||
} | ||
By("creating and verifying PVC bound status", createAndVerifyPVC) | ||
By("Creating and deploying app pod", createDeployVerifyApp) | ||
By("Expanding PVC", expandPVC) | ||
By("Verifying updated size in application pod", verifyIncreasedSizeInAppPod) | ||
By("Deleting application deployment", deleteAppDeployment) | ||
By("Deleting pvc", deletePVC) | ||
} | ||
|
||
func prepareForVolumeResizeTest() { | ||
By("Creating storage class", createStorageClass) | ||
} | ||
|
||
func cleanupAfterVolumeResizeTest() { | ||
By("Deleting storage class", deleteStorageClass) | ||
} |
Oops, something went wrong.