-
Notifications
You must be signed in to change notification settings - Fork 78
SREP-1216: Added E2E Test - Delete the ClusterDeployment #368
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
base: master
Are you sure you want to change the base?
Conversation
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: drakshakhan The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/label tide/merge-method-squash |
@drakshakhan: This pull request references SREP-1216 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 task to target the "4.20.0" version, but no target version was set. In 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. |
@drakshakhan: This pull request references SREP-1216 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 task to target the "4.20.0" version, but no target version was set. In 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. |
}, pollingDuration, 30*time.Second).Should(BeTrue(), "Certificate secret should be applied to apiserver object") | ||
}) | ||
|
||
It("Delete the Cluster Deployment", func(ctx context.Context) { |
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.
Delete clusterdeployment is not part of the functionality of the certman-operator.
So we should not test like this. Instead, we can update it like following test scenarios.
- certman-opreator finalizer should not block clusterdeployment being deleted
- certificaterequest should be deleted when the clusterdeployment being deleted
- primary-cert-bundle-secret should be deleted accordingly when the clusterdeployment being deleted
|
||
Eventually(func() bool { | ||
logger.Info("Checking if ClusterDeployment exist or not") | ||
cdList, err := dynamicClient.Resource(clusterDeploymentGVR).Namespace("certman-operator").List(ctx, metav1.ListOptions{}) |
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.
As we discussed in the sync meet, please try to create the clusterdeployment is a separated namespace rather than the certman-operator
if len(finalizers) > 0 { | ||
logger.Info("CertificateRequest not deleted due to finalizers. Removing finalizers", "name", crName) | ||
cr.SetFinalizers([]string{}) | ||
_, err := dynamicClient.Resource(certRequestGVR).Namespace("certman-operator").Update(ctx, &cr, metav1.UpdateOptions{}) |
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.
we should not remove the finalizer manually here. It needs to be handled by the operator/controller.
@drakshakhan: all tests passed! Full PR test history. Your PR dashboard. 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 kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #368 +/- ##
==========================================
+ Coverage 49.00% 51.87% +2.86%
==========================================
Files 29 29
Lines 2116 2138 +22
==========================================
+ Hits 1037 1109 +72
+ Misses 973 922 -51
- Partials 106 107 +1 🚀 New features to boost your workflow:
|
This PR ensures that deleting a ClusterDeployment with the finalizer certificaterequests.certman.managed.openshift.io automatically deletes the associated CertificateRequest and primary-cert-bundle-secret. The deletion process has been verified to work as expected.
To run the test case, you need to export the below environment variable:
DISABLE_JUNIT_REPORT=false
To run the test:
go test -tags=osde2e ./test/e2e -v
output -
output.txt
output2.txt