Skip to content

Conversation

drakshakhan
Copy link

@drakshakhan drakshakhan commented Jul 23, 2025

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

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 23, 2025

@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:

This PR adds an end-to-end test to 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 automatically and verified.

To run the test case, you need to export two environment variables:
DISABLE_JUNIT_REPORT=false
CLUSTER_NAME=

Then run the test with the command:
go test -tags=osde2e ./test/e2e -v

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.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 23, 2025
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 23, 2025
Copy link
Contributor

openshift-ci bot commented Jul 23, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link
Contributor

openshift-ci bot commented Jul 23, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: drakshakhan
Once this PR has been reviewed and has the lgtm label, please assign clcollins for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 23, 2025

@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:

SREP_1073_test-cases.txt
SREP_1073_test-cases2.txt
This PR adds an end-to-end test to 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 automatically and verified.

To run the test case, you need to export two environment variables:
DISABLE_JUNIT_REPORT=false
CLUSTER_NAME=

Then run the test with the command:
go test -tags=osde2e ./test/e2e -v

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.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 23, 2025

@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:

This PR adds an end-to-end test to 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 automatically and verified.

To run the test case, you need to export two environment variables:
DISABLE_JUNIT_REPORT=false
CLUSTER_NAME=

Then run the test with the command:
go test -tags=osde2e ./test/e2e -v

output -
SREP_1073_test-cases.txt
SREP_1073_test-cases2.txt

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 drakshakhan marked this pull request as ready for review July 24, 2025 06:37
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 24, 2025
Copy link

codecov bot commented Jul 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.04%. Comparing base (51fb70f) to head (15b52c8).
⚠️ Report is 20 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            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     

see 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@drakshakhan
Copy link
Author

/test validate

1 similar comment
@drakshakhan
Copy link
Author

/test validate

@drakshakhan
Copy link
Author

/label tide/merge-method-squash

@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jul 25, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 25, 2025

@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:

This PR adds an end-to-end test to 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 automatically and verified.

To run the test case, you need to export two environment variables:
DISABLE_JUNIT_REPORT=false
CLUSTER_NAME=""

Then run the test with the command:
go test -tags=osde2e ./test/e2e -v

output -
SREP_1073_test-cases.txt
SREP_1073_test-cases2.txt

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.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 25, 2025

@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:

This PR adds an end-to-end test to 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 automatically 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 -
SREP_1073_test-cases.txt
SREP_1073_test-cases2.txt

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 drakshakhan changed the title SREP-1073: Added E2E Test - Check OwnerReference in CertificateRequest SREP-1219: Added E2E Test - Check OwnerReference in CertificateRequest Jul 25, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 25, 2025

@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:

This PR adds an end-to-end test to 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 automatically 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 -
SREP_1073_test-cases.txt
SREP_1073_test-cases2.txt

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.

@bmeng
Copy link
Contributor

bmeng commented Jul 31, 2025

/retest

@drakshakhan drakshakhan changed the title SREP-1219: Added E2E Test - Check OwnerReference in CertificateRequest SREP-1219: Added E2E Test - Check OwnerReference in CertificateRequest, Remove finalizers from CertificateRequest and ClusterDeployment Jul 31, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 31, 2025

@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:

This PR introduces several updates as part of the following Jira tickets:

[JIRA-5678] 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.

[JIRA-91011] 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.

[JIRA-1234] 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 -
SREP_1073_test-cases.txt
SREP_1073_test-cases2.txt

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.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 31, 2025

@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:

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 -
SREP_1073_test-cases.txt
SREP_1073_test-cases2.txt

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.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 31, 2025

@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:

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

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
Copy link
Author

/test validate

@drakshakhan
Copy link
Author

/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")
Copy link
Contributor

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{})
Copy link
Contributor

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)
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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))
Copy link
Contributor

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.

Copy link
Contributor

openshift-ci bot commented Aug 28, 2025

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants