Skip to content
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

Added unit tests for node_tree in pkg/util/lifted/scheduler/cache #5422

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yashpandey06
Copy link
Contributor

@yashpandey06 yashpandey06 commented Aug 25, 2024

/kind feature

This PR introduces unit tests for the node_tree file :

  1. TestNewNodeTree: Initialize a NodeTree with nodes.
  2. TestAddNode: Add a new node to the NodeTree.
  3. TestAddExistingNode: Handle adding an existing node.
  4. TestRemoveNode: Remove a node from the NodeTree.
  5. TestRemoveNonExistentNode: Attempt to remove a non-existent node.
  6. TestUpdateNode: Update node details.
  7. TestList: List all nodes.
  8. TestListEmpty: Handle an empty NodeTree.
  9. TestListExhaustedZones: Handle exhausted zones.

Fixes part of #5235

Coverage : 96.5 %

Does this PR introduce a user-facing change?:

NONE

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 25, 2024
@karmada-bot
Copy link
Collaborator

[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 xishanyongye-chang for approval. For more information see the Kubernetes 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

@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 25, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 25, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 30.40%. Comparing base (aee21b8) to head (e21572d).
Report is 24 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5422      +/-   ##
==========================================
- Coverage   30.58%   30.40%   -0.18%     
==========================================
  Files         632      632              
  Lines       43936    43936              
==========================================
- Hits        13438    13360      -78     
- Misses      29519    29622     +103     
+ Partials      979      954      -25     
Flag Coverage Δ
unittests 30.40% <ø> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@XiShanYongYe-Chang
Copy link
Member

/retest

@yashpandey06
Copy link
Contributor Author

@XiShanYongYe-Chang , the pr has passed the ci tests, we can move ahead with the review .

Thanks 😊


// This code is directly lifted from the Kubernetes codebase in order to avoid relying on the k8s.io/kubernetes package.
// For reference:
// https://github.com/kubernetes/kubernetes/blob/release-1.26/pkg/scheduler/internal/cache/node_tree.go
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@yashpandey06 yashpandey06 Aug 26, 2024

Choose a reason for hiding this comment

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

Hey @XiShanYongYe-Chang , i took headers from node_tree itself for which the tests have been written . please see

Screenshot 2024-08-26 at 9 15 13 AM

Copy link
Member

Choose a reason for hiding this comment

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

I mean you can just copy the test functions you need from this file, no need to add extra tests yourself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@XiShanYongYe-Chang I got your point .Let me revisit this .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants