OCPEDGE-2329: unit and e2e tests for the storageClass options feature#2074
OCPEDGE-2329: unit and e2e tests for the storageClass options feature#2074Neilhamza wants to merge 3 commits intoopenshift:mainfrom
Conversation
|
@Neilhamza: This pull request references OCPEDGE-2329 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Neilhamza The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2074 +/- ##
==========================================
+ Coverage 49.39% 51.73% +2.33%
==========================================
Files 52 52
Lines 3778 3901 +123
==========================================
+ Hits 1866 2018 +152
+ Misses 1759 1715 -44
- Partials 153 168 +15 🚀 New features to boost your workflow:
|
5c5c5f4 to
ac01734
Compare
|
@Neilhamza: This pull request references OCPEDGE-2329 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
d04a413 to
9d87aab
Compare
Cover the StorageClassOptions feature and SSA StorageClass migration with unit tests (webhook validation, SC construction, deletion gates, retain policy) and 14 e2e specs (property verification, webhook rejection, XValidation immutability, functional provisioning with Immediate/WaitForFirstConsumer/Retain/additionalParameters, and SSA label pruning). LV cleanup uses the TopoLVM LogicalVolume CR API.
9d87aab to
0afb12e
Compare
Signed-off-by: nhamza <nhamza@redhat.com>
|
/test unit-test |
Signed-off-by: nhamza <nhamza@redhat.com>
|
/test ci/prow/unit-test |
|
/test ci/prow/e2e-aws |
|
/test unit-test |
|
/test e2e-aws |
|
/test e2e-aws-hypershift |
|
@Neilhamza: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
this PR targets the following Jira tickets:
https://issues.redhat.com/browse/OCPEDGE-2329
https://issues.redhat.com/browse/OCPEDGE-2350
Summary
Add comprehensive test coverage for the StorageClassOptions feature and SSA migration across unit and e2e layers.
Unit tests
Webhook validation (
api/v1alpha1/lvmcluster_test.go): 9 new envtest cases covering admission rejection of LVMS-owned parameter keys (topolvm.io/device-class,csi.storage.k8s.io/fstype), empty keys, invalid label keys/values, reservedapp.kubernetes.iolabels,owned-by.topolvm.ioprefix labels, and acceptance of valid custom parameters and labels on both create and update.StorageClass construction (
internal/controllers/lvmcluster/resource/topolvm_storageclass_test.go): New file with tests forgetTopolvmStorageClassesverifying defaults (Delete/WaitForFirstConsumer), custom options (Retain/Immediate), additional parameters with LVMS-owned key override protection, additional labels with managed label override protection, default SC annotation logic, SSA patch type and field ownership, and EnsureDeleted behavior (not found, exists, deletion in progress).LVMCluster controller deletion gates (
internal/controllers/lvmcluster/controller_test.go): New file testingactivePVCsExistForClusterStorageClasses(no PVCs, matching PVC, non-matching PVC, list error) andretainPVsExistForCluster(no Retain policy, Retain with PVs, Retain without PVs, list error) using a field-filtering interceptor client since the fake client does not support MatchingFields natively.VGManager retain policy (
internal/controllers/vgmanager/controller_test.go): Tests forisRetainPolicy(Delete policy, Retain policy, SC not found, Get error safety default, nil ReclaimPolicy) andprocessDeleteretain behavior (blocks deletion when user LVs exist, proceeds when only thin pool LV exists, proceeds when no LVs exist).E2E tests
StorageClassOptions (
test/e2e/storage_class_options_test.go): New file registered in the test suite, covering five areas against a live cluster (14 specs, 8 cluster cycles, ~5 min runtime):owned-by.topolvm.iolabelsKey design decisions:
DeferCleanupinBeforeEach(notAfterEach) to ensure LIFO ordering: PVC/pod cleanups registered inItblocks run first, preventing cluster deletion from being blocked by active PVCsLogicalVolumeCR API for LV cleanup instead of exec-basedlvremove, avoiding privileged pod accessOrdered+BeforeAllsince rejected updates don't modify server state