Skip to content

workloadmanager: add tests for sandbox entrypoint probing - #498

Merged
volcano-sh-bot merged 2 commits into
volcano-sh:mainfrom
altf4-games:test/sandbox-entrypoint-probe
Nov 3, 2026
Merged

volcano-sh-bot merged 2 commits into
volcano-sh:mainfrom
altf4-games:test/sandbox-entrypoint-probe

Conversation

@altf4-games

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Adds unit tests for the sandbox entrypoint readiness probe in pkg/workloadmanager/sandbox_helper.go, which came in with #256. waitForSandboxEntryPointsReady and probeSandboxEntryPoints had no direct tests. handlers_test.go only patches them out, which Copilot's review on #256 also pointed out.

The tests replace sandboxEntrypointDial with a fake. They check retries, the timeout error, the dial timeout cap, the default values, nil server and config, context cancellation, and multi-port readiness (each pass dials all ports again). They also run the real dialer against a local listener. No production code changes.

Which issue(s) this PR fixes:

None.

Special notes for your reviewer:

  • The tests are in their own file so they don't conflict with Upgrade agent sandbox v0.5.3 #446, which edits sandbox_helper_test.go. I can move them if you'd rather have one file.
  • To check that the tests catch bugs, I broke sandbox_helper.go nine ways (for example dropping %w, removing the dial cap, skipping the retry, probing only the first port). Each one made a test fail. I also ran the tests with -race on 1 and 4 CPUs.
  • Each test finishes in 0.3s or less. The upper-bound checks are loose (5s). The tests don't run in parallel because they replace a package variable.
  • AI use: I used Claude to help write and review the tests. I read each case and can explain it.

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: Pradyum Mistry <39883432+altf4-games@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 1, 2026 06:19

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@codecov-commenter

codecov-commenter commented Nov 1, 2026 •

Copy link
Copy Markdown

⚠️ 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 62.53%. Comparing base (f521ae9) to head (40608bf).
⚠️ Report is 22 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #498      +/-   ##
==========================================
+ Coverage   60.45%   62.53%   +2.07%     
==========================================
  Files          35       35              
  Lines        3616     3659      +43     
==========================================
+ Hits         2186     2288     +102     
+ Misses       1211     1146      -65     
- Partials      219      225       +6     
Flag Coverage Δ
unittests 62.53% <ø> (+2.07%) ⬆️

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

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

@acsoto acsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

generally LG
The exact dial-count assertions in the cancellation tests can be flaky if cancellation and the retry timer are both ready. Could these check cancellation and bounded completion instead? The defaults test could use a live context with a successful fake dial to keep it independent of cancellation behavior.

Signed-off-by: Pradyum Mistry <39883432+altf4-games@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 2, 2026 13:20

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@altf4-games

Copy link
Copy Markdown
Contributor Author

@acsoto Good catch. The cancel test now only checks that the cancelling dial ran, that the error wraps the dial error, and that it returns well before the timeout. The defaults test uses a live context and a successful fake dial. Pushed.

@acsoto

acsoto commented Nov 3, 2026

Copy link
Copy Markdown
Member

/lgtm

@acsoto

acsoto commented Nov 3, 2026

Copy link
Copy Markdown
Member

/approve

@volcano-sh-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: acsoto

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

@volcano-sh-bot
volcano-sh-bot merged commit 5a8a099 into volcano-sh:main Nov 3, 2026
15 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.

5 participants