Skip to content

test(kubeclient): add IsReady edge-case coverage and missing-NodeReady behavior fix - #5771

Merged
cheyang merged 9 commits into
fluid-cloudnative:masterfrom
r0hansaxena:node-readiness-edge-tests
Nov 12, 2026
Merged

cheyang merged 9 commits into
fluid-cloudnative:masterfrom
r0hansaxena:node-readiness-edge-tests

Conversation

@r0hansaxena

@r0hansaxena r0hansaxena commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

Ⅰ. Describe what this PR does

test(pkg/utils/kubeclient) : add IsReady edge-case tests and update IsReady to return false when NodeReady is missing.

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

  • IsReady: cover no NodeReady condition, NodeReady=Unknown, and mixed conditions where NodeReady=False

Ⅳ. Describe how to verify it

go test ./pkg/utils/kubeclient -v --ginkgo.focus="IsReady"

Ⅴ. Special notes for reviews

@fluid-e2e-bot

fluid-e2e-bot Bot commented Apr 7, 2026

Copy link
Copy Markdown

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.

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

Copy link
Copy Markdown
Contributor

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 the IsReady function to verify node readiness logic under various conditions, including missing, unknown, and false NodeReady statuses. A significant issue was identified regarding the handling of nodes with a missing NodeReady condition; the current implementation incorrectly defaults to true, which contradicts standard Kubernetes behavior and should be updated to default to false.

Comment thread pkg/utils/kubeclient/node_test.go Resolved
@r0hansaxena

Copy link
Copy Markdown
Contributor Author

/gemini review

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

Copy link
Copy Markdown
Contributor

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 refactors the IsReady function in pkg/utils/kubeclient/node.go to simplify the logic for checking node readiness and adds comprehensive test cases in pkg/utils/kubeclient/node_test.go to cover scenarios with missing, unknown, or false readiness conditions. A review comment suggests removing a redundant variable initialization to align with Go's zero-value behavior for named return parameters.

Comment thread pkg/utils/kubeclient/node.go Resolved
@cheyang

cheyang commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator

/ok-to-test

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Ginkgo/Gomega unit test coverage for kubeclient.IsReady edge cases and adjusts IsReady to treat missing NodeReady condition as not ready (false), aligning behavior with the new tests and expected semantics.

Changes:

  • Update IsReady to return based on the NodeReady condition when present, and default to false when absent.
  • Add unit tests covering: no NodeReady condition, NodeReady=Unknown, and mixed conditions with NodeReady=False.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/utils/kubeclient/node.go Changes IsReady readiness evaluation logic (behavior change for missing NodeReady).
pkg/utils/kubeclient/node_test.go Adds Ginkgo tests for additional IsReady edge cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/utils/kubeclient/node.go Resolved
Comment thread pkg/utils/kubeclient/node.go Resolved
@codecov

codecov Bot commented Apr 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.75%. Comparing base (6ecd70f) to head (ba863a6).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5771      +/-   ##
==========================================
- Coverage   65.75%   65.75%   -0.01%     
==========================================
  Files         486      486              
  Lines       34459    34458       -1     
==========================================
- Hits        22660    22659       -1     
  Misses      10044    10044              
  Partials     1755     1755              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@r0hansaxena r0hansaxena changed the title test(kubeclient): add IsReady edge case test coverage test(kubeclient): add IsReady edge-case coverage and missing-NodeReady behavior fix Apr 7, 2026
@r0hansaxena

Copy link
Copy Markdown
Contributor Author

/gemini review

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

Copy link
Copy Markdown
Contributor

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 refactors the IsReady function in pkg/utils/kubeclient/node.go to correctly return false when the NodeReady condition is missing or not explicitly set to True. Previously, the function defaulted to true, which was incorrect for nodes with no conditions. Corresponding unit tests were added to cover these scenarios. A review comment suggests further enhancing the test suite by explicitly adding a case for an empty conditions slice to ensure this specific regression is documented and prevented.

Comment thread pkg/utils/kubeclient/node_test.go Resolved
@r0hansaxena

Copy link
Copy Markdown
Contributor Author

/gemini review

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

Copy link
Copy Markdown
Contributor

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 refactors the IsReady function in pkg/utils/kubeclient/node.go to improve logic clarity and correctly handle cases where the NodeReady condition is missing. It also adds comprehensive unit tests to cover various node condition scenarios. Feedback focuses on improving the descriptiveness of the newly added test cases to enhance clarity in test reports.

Comment thread pkg/utils/kubeclient/node_test.go Resolved
Comment thread pkg/utils/kubeclient/node_test.go Resolved
Comment thread pkg/utils/kubeclient/node_test.go Resolved
r0hansaxena and others added 8 commits April 7, 2026 17:21
Signed-off-by: r0hansaxena <rohansxn8772@gmail.com>
Signed-off-by: r0hansaxena <rohansxn8772@gmail.com>
Signed-off-by: r0hansaxena <rohansxn8772@gmail.com>
Signed-off-by: r0hansaxena <rohansxn8772@gmail.com>
Signed-off-by: r0hansaxena <rohansxn8772@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: r0hansaxena <rohansxn8772@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: r0hansaxena <rohansxn8772@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: r0hansaxena <rohansxn8772@gmail.com>
@r0hansaxena
r0hansaxena force-pushed the node-readiness-edge-tests branch from d53c6c0 to a416c2c Compare April 7, 2026 11:52
@sonarqubecloud

sonarqubecloud Bot commented Apr 7, 2026

Copy link
Copy Markdown

@r0hansaxena

Copy link
Copy Markdown
Contributor Author

@cheyang could you please have a look again? thank you

@cheyang

cheyang commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Important behavior fix: IsReady() previously returned true for nodes without a NodeReady condition, which is incorrect — a node with no readiness signal should be treated as not-ready. The refactored logic is cleaner (find-and-return vs flag-and-break) and the new tests cover all edge cases: empty conditions, missing NodeReady, ConditionUnknown, and mixed condition lists.

Verdict: ready-to-merge

@cheyang cheyang added the lgtm label Jun 17, 2026
@fluid-e2e-bot

fluid-e2e-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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

The pull request process is described 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@sonarqubecloud

Copy link
Copy Markdown

@cheyang cheyang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

IsReady now follows the NodeReady condition and treats a missing condition as not ready. The only reference in the tree is a commented-out call in pkg/ddc/alluxio/cache.go, so no caller changes behaviour. I updated the branch onto current master; lint, unittest and the kind-e2e/backward-compat matrices all pass on this head. Thanks @r0hansaxena!

@cheyang
cheyang merged commit 905af86 into fluid-cloudnative:master Nov 12, 2026
22 checks passed
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.

3 participants