Skip to content

test(kubeclient): add cronjob fallback status cases#5773

Open
r0hansaxena wants to merge 2 commits intofluid-cloudnative:masterfrom
r0hansaxena:cronjob-fallback-status-tests
Open

test(kubeclient): add cronjob fallback status cases#5773
r0hansaxena wants to merge 2 commits intofluid-cloudnative:masterfrom
r0hansaxena:cronjob-fallback-status-tests

Conversation

@r0hansaxena
Copy link
Copy Markdown

Ⅰ. Describe what this PR does

test(pkg/utils/kubeclient): add unit tests for GetCronJobStatus fallback path when batch/v1 CronJob is not supported.

Ⅱ. Does this pull request fix one issue?

part of #5407

Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

  • GetCronJobStatus returns converted status from batch/v1beta1 CronJob when batch/v1 is not supported.
  • GetCronJobStatus returns error when batch/v1 is not supported and batch/v1beta1 CronJob is not found.

Ⅳ. Describe how to verify it

go test ./pkg/utils/kubeclient -v

Ⅴ. Special notes for reviews

Signed-off-by: r0hansaxena <rohansxn8772@gmail.com>
@fluid-e2e-bot
Copy link
Copy Markdown

fluid-e2e-bot bot commented Apr 7, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign trafalgarzzz for approval by writing /assign @trafalgarzzz in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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

@fluid-e2e-bot
Copy link
Copy Markdown

fluid-e2e-bot bot commented Apr 7, 2026

Hi @r0hansaxena. Thanks for your PR.

I'm waiting for a fluid-cloudnative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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/test-infra repository.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds unit tests for GetCronJobStatus to verify the fallback mechanism for batchv1beta1 CronJobs when batchv1 is not supported by the cluster. The review feedback suggests improving the test setup by properly handling errors during scheme registration and refactoring the new test cases to eliminate redundant mocking logic through a shared BeforeEach block.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds unit tests for GetCronJobStatus to verify the fallback logic when batchv1 CronJobs are not supported and batchv1beta1 is used instead. The feedback suggests improving the test setup by moving the scheme registration to a global initialization block like BeforeSuite to avoid potential race conditions and redundant calls, and recommends checking the error returned by AddToScheme rather than ignoring it.

Signed-off-by: r0hansaxena <rohansxn8772@gmail.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 7, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant