-
Notifications
You must be signed in to change notification settings - Fork 79
SREP-1219: Added E2E Test - Check OwnerReference in CertificateRequest, Remove finalizers from CertificateRequest and ClusterDeployment #352
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
@drakshakhan: This pull request references SREP-1073 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. |
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 |
@drakshakhan: This pull request references SREP-1073 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-1073 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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #352 +/- ##
==========================================
+ Coverage 49.00% 52.04% +3.03%
==========================================
Files 29 29
Lines 2116 2152 +36
==========================================
+ Hits 1037 1120 +83
+ Misses 973 925 -48
- Partials 106 107 +1 🚀 New features to boost your workflow:
|
/test validate |
1 similar comment
/test validate |
/label tide/merge-method-squash |
@drakshakhan: This pull request references SREP-1073 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-1073 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-1219 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. |
…certificate request
/retest |
@drakshakhan: This pull request references SREP-1219 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-1219 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-1219 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. |
/test validate |
/test validate |
Expect(dynamicClient).ShouldNot(BeNil(), "dynamic client is nil") | ||
|
||
clusterName = os.Getenv("CLUSTER_NAME") | ||
Expect(clusterName).ToNot(BeEmpty(), "CLUSTER_NAME environment variable must be set") |
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.
Why this must be set? I did not see it is used anywhere in the test.
|
||
logger.Info("Finalizers removed from ClusterDeployment", "name", cdName) | ||
|
||
updatedCD, err := dynamicClient.Resource(clusterDeploymentGVR).Namespace("certman-operator").Get(ctx, cdName, metav1.GetOptions{}) |
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 one of the sync meet. Lets try to put the clusterdeployment into a separated namespace rather than certman-operator
|
||
updatedCD, err := dynamicClient.Resource(clusterDeploymentGVR).Namespace("certman-operator").Get(ctx, cdName, metav1.GetOptions{}) | ||
if err != nil { | ||
logger.Info("ClusterDeployment is deleted", "name", cdName) |
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.
Why we consider the Clusterdeployment is deleted if the get client request failed in previous step?
}, pollingDuration, 30*time.Second).Should(BeTrue(), "Certificate secret should be applied to apiserver object") | ||
}) | ||
|
||
It("remove finalizer from the ClusterDeployment", 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.
It will trigger the finalizer deletion on a certain finalizer when the clusterdeployment is deleted.
I cannot quite understand the test here. It seems we try to set the finalizer to empty in the test itself? How would it related to the operator functionality?
}, pollingDuration, 30*time.Second).Should(BeTrue(), "ClusterDeployment should be deleted or have finalizer re-added") | ||
}) | ||
|
||
It("remove finalizer from the CertificateRequest", 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.
same here, the remove finalizer to certificaterequest happens only when the certificaterequest being deleted.
The function within the test which is setting finalizer to empty string did not test the operator/controller's function.
UID: certRequest.GetUID(), | ||
} | ||
|
||
certRequest.SetOwnerReferences(append(ownerRefs, ownerRef)) |
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 set the ownerReference within the test like this. We need to check the functionality of 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. |
This PR introduces several updates as part of the following Jira tickets:
[SREP-1217] Test: Remove finalizer in ClusterDeployment (deleted when CD deleted):
This test verifies that if the finalizer is removed from a ClusterDeployment and the ClusterDeployment is not being deleted, the finalizer is automatically re-added.
[SREP-1218)] Test: Remove finalizer from the CertificateRequest:
This test verifies that if the finalizer is removed from a CertificateRequest and the CertificateRequest is not being deleted, the finalizer is automatically re-added.
[SREP-1219] Test: Check OwnerReference in CertificateRequest:
This test ensure that the ClusterDeployment is set as the owner of the CertificateRequest in the certman-operator namespace. If the owner reference is missing, it is added to the CertificateRequest and verified.
To run the test case, you need to export two environment variables:
DISABLE_JUNIT_REPORT=false
CLUSTER_NAME=cluster-name
Then run the test with the command:
go test -tags=osde2e ./test/e2e -v
output -
test_case_output.txt