Expose NodeInfo to Score plugins

Co-authored-by: shenxin <rougang.hrg@alibaba-inc.com>
Signed-off-by: saintube <saintube@foxmail.com>
This commit is contained in:
saintube
2025-03-03 18:24:16 +08:00
committed by shenxin
parent 5d28e86245
commit afb4e96510
27 changed files with 138 additions and 105 deletions

View File

@@ -419,7 +419,11 @@ func TestLeastAllocatedScoringStrategy(t *testing.T) {
var gotScores framework.NodeScoreList
for _, n := range test.nodes {
score, status := p.(framework.ScorePlugin).Score(ctx, state, test.requestedPod, n.Name)
nodeInfo, err := snapshot.Get(n.Name)
if err != nil {
t.Errorf("failed to get node %q from snapshot: %v", n.Name, err)
}
score, status := p.(framework.ScorePlugin).Score(ctx, state, test.requestedPod, nodeInfo)
if status.Code() != test.wantStatusCode {
t.Errorf("unexpected status code, want: %v, got: %v", test.wantStatusCode, status.Code())
}