Repository navigation
workloadmanager: add tests for sandbox entrypoint probing - #498
Conversation
Signed-off-by: Pradyum Mistry <39883432+altf4-games@users.noreply.github.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
acsoto
left a comment
There was a problem hiding this comment.
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>
|
@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. |
|
/lgtm |
|
/approve |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.waitForSandboxEntryPointsReadyandprobeSandboxEntryPointshad no direct tests.handlers_test.goonly patches them out, which Copilot's review on #256 also pointed out.The tests replace
sandboxEntrypointDialwith 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:
sandbox_helper_test.go. I can move them if you'd rather have one file.sandbox_helper.gonine 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-raceon 1 and 4 CPUs.Does this PR introduce a user-facing change?: