-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: added the test for ephemeral volume in e2e #246
test: added the test for ephemeral volume in e2e #246
Conversation
d3da6a5
to
b6e050d
Compare
resources: | ||
requests: | ||
storage: 1Gi | ||
storageClassName: %s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
storageClassName: %s | |
storageClassName: %s | |
volumeMode: Block |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
e2e/ephemeral_check.go
Outdated
|
||
func ephemeralTest() { | ||
Describe("Ephemeral Volume Tests", func() { | ||
var pvc *k8sv1.PersistentVolumeClaim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var pvc *k8sv1.PersistentVolumeClaim | |
var pvc *k8sv1.PersistentVolumeClaim = &k8sv1.PersistentVolumeClaim{} |
e2e/ephemeral_check.go
Outdated
fmt.Printf("Pod %s is running\n", ephemeralPod.Name) | ||
|
||
By("Creating a Snapshot of the pvc") | ||
snapshotYaml := fmt.Sprintf(volumeSnapshotYAMLTemplate, "ephemeralfilepvc-snapshot", testNamespace, snapshotClass, "ephemeral-filepod-generic-ephemeral-volume") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create separate YAMLs for each resource you create in this test in the ephemeral_tests dir. It makes it easy to keep track of which file is used in which test.
Rename ephemeral_test dir to ephemeral_tests.
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 1Gi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PVC Clone operations will fail because the size in the pvcCloneYAMLTemplate does not match the size in the ephemeral volume spec. Please create a different yaml in the ephemeral_tests dir.
e2e/ephemeral_check.go
Outdated
By("Verifying that the Snapshot is ready") | ||
Eventually(func() bool { | ||
err := crClient.Get(ctx, types.NamespacedName{Name: snapshot.Name, Namespace: snapshot.Namespace}, snapshot) | ||
return err == nil && *snapshot.Status.ReadyToUse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return err == nil && *snapshot.Status.ReadyToUse | |
return err == nil && snapshot.Status != nil && *snapshot.Status.ReadyToUse |
e2e/ephemeral_check.go
Outdated
By("Verifying that the Snapshot is ready") | ||
Eventually(func() bool { | ||
err := crClient.Get(ctx, types.NamespacedName{Name: snapshot.Name, Namespace: snapshot.Namespace}, snapshot) | ||
return err == nil && *snapshot.Status.ReadyToUse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return err == nil && *snapshot.Status.ReadyToUse | |
return err == nil && snapshot.Status != nil && *snapshot.Status.ReadyToUse |
4ebff69
to
1462926
Compare
1462926
to
e5b319e
Compare
e2e/lvm_suite_test.go
Outdated
@@ -26,4 +26,5 @@ var _ = AfterSuite(func() { | |||
var _ = Describe("LVMO e2e tests", func() { | |||
Context("LVMCluster reconciliation", validateResources) | |||
Context("PVC tests", pvcTest) | |||
Context("Ephemeral tests", ephemeralTest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context("Ephemeral tests", ephemeralTest) | |
Context("Ephemeral volume tests", ephemeralTest) |
e5b319e
to
595aedf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update https://github.com/red-hat-storage/lvm-operator/blob/a99277e6e488db82f43faac58201cedeca0f4ff4/.github/workflows/conf/yamllint.yaml#L7 to ignore the newly added template yamls .
3e32301
to
f1590cd
Compare
Thanks for mentioning. Updated. |
e2e/ephemeral_check.go
Outdated
//go:embed testdata/ephemeral_tests/pod-ephemeral-volume-device.yaml | ||
var podEphemeralBlockYAMLTemplate string | ||
|
||
//go:embed testdata/ephemeral_tests/pod-ephemeral-volume-mount.yaml | ||
var podEphemeralFSYAMLTemplate string | ||
|
||
//go:embed testdata/ephemeral_tests/ephemeral-volume-snapshot.yaml | ||
var ephemeralVolumeSnapshotYAMLTemplate string | ||
|
||
//go:embed testdata/ephemeral_tests/ephemeral-clone.yaml | ||
var ephemeralPvcCloneYAMLTemplate string | ||
|
||
//go:embed testdata/ephemeral_tests/ephemeral-snapshot-restore.yaml | ||
var ephemeralPvcSnapshotRestoreYAMLTemplate string | ||
|
||
//go:embed testdata/ephemeral_tests/pod-volume-mount-template.yaml | ||
var podFSYAMLTemplate string | ||
|
||
//go:embed testdata/ephemeral_tests/pod-volume-device-template.yaml | ||
var podBlockYAMLTemplate string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of multiple variable declarations, create a var
block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated.
return err == nil && ephemeralPod.Status.Phase == k8sv1.PodRunning | ||
}, timeout, interval).Should(BeTrue()) | ||
fmt.Printf("Pod %s is running\n", ephemeralPod.Name) | ||
|
||
By("Creating a Snapshot of the pvc") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write some data in the parent pvc and verify it later on cloned/restored volumes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's another PR doing this check. #235
Will modify once that gets merged.
Signed-off-by: riya-singhal31 <[email protected]>
f1590cd
to
4808fca
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nbalacha, riya-singhal31 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR adds the test for ephemeral volume, by creating a pod for ephemeral volume and confirming its lifetime.
Also creates snapshot and clone for the ephemeral volume.
Signed-off-by: riya-singhal31 [email protected]