Skip to content

fix(test): set LimitSet on the webhook quota fixtures to unbreak master - #2409

Closed
Lakshya77089 wants to merge 1 commit into
Project-HAMi:masterfrom
Lakshya77089:fix/quota-test-limitset
Closed

fix(test): set LimitSet on the webhook quota fixtures to unbreak master#2409
Lakshya77089 wants to merge 1 commit into
Project-HAMi:masterfrom
Lakshya77089:fix/quota-test-limitset

Conversation

@Lakshya77089

@Lakshya77089 Lakshya77089 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug
/kind failing-test

What this PR does / why we need it:

master is currently red. Three tests in pkg/scheduler/webhook_test.go fail:

--- FAIL: TestFitResourceQuotaNonNvidia
    webhook_test.go:561: fitResourceQuota() = true, want false
--- FAIL: TestFitResourceQuotaCountsEveryDevice
--- FAIL: TestFitResourceQuotaAscendMemoryFactor

Reproduces on a clean checkout with go test ./pkg/scheduler/ -run TestFitResourceQuota.

#2313 added Quota.LimitSet and changed FitQuota to gate on it rather than
Limit != 0, so that an explicit 0 is honoured as a hard block. A Quota
built directly as a struct literal, instead of going through AddQuota, now
defaults LimitSet to false and reads as "no limit configured".

#2313 spotted this and fixed the fixture in TestFitResourceQuota. In the
meantime #2347 had added three more tests that build their fixtures the same
way, and those were not updated. Each PR was green on its own; the conflict
only exists once both are on master, so neither CI run could have caught it.

This sets LimitSet: true on the remaining five fixtures so they match what
AddQuota produces. Test-only, no production code touched.

Which issue(s) this PR fixes:

None filed — raising the fix directly since master is broken.

Special notes for your reviewer:

Worth considering separately: the same trap is waiting for the next person who
writes a quota test. A small constructor, or making AddQuota the only way to
set a limit in tests, would stop it recurring. I have not done that here to keep
this to the minimum needed to get master green.

Does this PR introduce a user-facing change?:

NONE

AI assistance disclosure: this change was developed with Claude Code. Flagging
the extent up front per CONTRIBUTING.

Summary by CodeRabbit

  • Tests
    • Updated quota test fixtures to correctly indicate configured limits for Cambricon, Hygon, and Ascend devices, including multi-device MLU scenarios.

Project-HAMi#2313 gated FitQuota on Quota.LimitSet instead of Limit != 0, so a limit
built directly as a struct literal rather than through AddQuota now reads
as "no limit configured". That PR fixed the fixture in TestFitResourceQuota,
but Project-HAMi#2347 had meanwhile added three more tests that build their fixtures the
same way, and those were not updated.

Both PRs were green on their own; the conflict only appears once they are
both on master, so nothing caught it. TestFitResourceQuotaNonNvidia,
TestFitResourceQuotaCountsEveryDevice and TestFitResourceQuotaAscendMemoryFactor
currently fail on master.

Set LimitSet on the remaining fixtures so they match what AddQuota produces.

Signed-off-by: Lakshya77089 <lakshyasharma7708@gmail.com>
@hami-robot hami-robot Bot added kind/bug Something isn't working dco-signoff: yes labels Aug 6, 2026
@hami-robot

hami-robot Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Lakshya77089
Once this PR has been reviewed and has the lgtm label, please assign shouren for approval. 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

@hami-robot hami-robot Bot added the size/S label Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: df23611e-e3c3-4c62-b869-def8f246332e

📥 Commits

Reviewing files that changed from the base of the PR and between 87d9795 and 14aece8.

📒 Files selected for processing (1)
  • pkg/scheduler/webhook_test.go

📝 Walkthrough

Walkthrough

The webhook quota test fixtures now set LimitSet: true for Cambricon, Hygon, and Ascend quota entries. Production code and public declarations are unchanged.

Changes

Quota fixture updates

Layer / File(s) Summary
Mark quota limits as configured
pkg/scheduler/webhook_test.go
Cambricon, Hygon, and Ascend quota fixtures now mark their limits as explicitly configured, including the multi-device MLU case.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested reviewers: dsfans2014

Poem

A bunny checked each quota line,
“LimitSet” flags now all shine.
MLU, DCU, Ascend too,
Their test limits state what’s true.
Hop, hop—five small edits done!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the test-only change that sets LimitSet on webhook quota fixtures.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai
coderabbitai Bot requested a review from DSFans2014 August 6, 2026 13:52
@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 63.39% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

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

@archlitchi

Copy link
Copy Markdown
Member

fixed

@archlitchi archlitchi closed this Aug 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.

2 participants