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

[YUNIKORN-2998] tryNodesNoReserve is not tested #1008

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kousei47747
Copy link

@kousei47747 kousei47747 commented Dec 25, 2024

What is this PR for?

Add unit test for tryNodesNoReserve, including 5 test cases:

  • Node is the reserved node
  • Node is unschedulable
  • Node does not have enough resources
  • Node fails predicate
  • Allocation succeeds

What type of PR is it?

  • - Bug Fix
  • - Improvement
  • - Feature
  • - Documentation
  • - Hot Fix
  • - Refactoring

What is the Jira issue?

https://issues.apache.org/jira/browse/YUNIKORN-2998

Copy link
Contributor

@ryankert01 ryankert01 left a comment

Choose a reason for hiding this comment

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

overall lgtm! btw, is there a way to cover L1430?

pkg/scheduler/objects/application_test.go Outdated Show resolved Hide resolved
@kousei47747
Copy link
Author

kousei47747 commented Dec 25, 2024

@ryankert01 Thanks for reviewing! I've added the variables and another test case, the code coverage has now reached 100%. PTAL :)

  • nodeID3 = "node-3"
    nodeID4 = "node-4"
    nodeID5 = "node-5"
  • // case 4: node fails predicate
    mockPlugin := mockCommon.NewPredicatePlugin(false, map[string]int{nodeID4: 1})
    plugins.RegisterSchedulerPlugin(mockPlugin)
    defer plugins.UnregisterSchedulerPlugins()
    node4 := newNode(nodeID4, map[string]resources.Quantity{"first": 5})
    iterator = getNodeIteratorFn(node4)
    result = app.tryNodesNoReserve(ask, iterator(), node1.NodeID)
    assert.Assert(t, result == nil, "result should be nil since node4 fails predicate")

Copy link
Contributor

@ryankert01 ryankert01 left a comment

Choose a reason for hiding this comment

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

edit: sorry, I forget to fetch the new code. It's indeed 100% and has L1430 covered. great work!


L1430 still not covered, but I think it might be fine if there's no way to do it.

also leaves some comments.

pkg/scheduler/objects/coverage.out Outdated Show resolved Hide resolved
coverage.out Outdated Show resolved Hide resolved
Copy link
Contributor

@ryankert01 ryankert01 left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

codecov bot commented Dec 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.48%. Comparing base (a351764) to head (3cfe7d0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1008      +/-   ##
==========================================
+ Coverage   82.34%   82.48%   +0.14%     
==========================================
  Files          97       97              
  Lines       15627    15627              
==========================================
+ Hits        12868    12890      +22     
+ Misses       2479     2457      -22     
  Partials      280      280              

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

Copy link
Contributor

@chenyulin0719 chenyulin0719 left a comment

Choose a reason for hiding this comment

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

+1 LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants