test(status): add unit tests for the version and config_dump handlers - #1851
Dreamstick9 wants to merge 1 commit into
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Codecov Report✅ All modified and coverable lines are covered by tests. Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
The version and configDumpAds handlers of the admin status server had no unit test coverage. Add tests asserting that the version endpoint serves the build info as JSON, and that the kernel-native config_dump endpoint rejects non-ads clients with 400 and correctly dumps clusters, listeners and routes seeded into the in-memory ads cache. Signed-off-by: Kushagar Garg <dreamstick909@gmail.com>
5d57da7 to
c6e1534
Compare
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Adds unit tests for two handlers of the admin status server (
localhost:15200) that currently have no test coverage at all:version(pkg/status/status_server.go:117): serves the daemon build info, used bykmeshctl version. New testTestServer_versionasserts a 200 response whose JSON body round-trips to exactlyversion.Get().configDumpAds(pkg/status/status_server.go:446): serves/debug/config_dump/kernel-native, used bykmeshctl dump. New testTestServer_configDumpAdscovers three behaviors:xdsClient, or dual-engine mode) returns 400 with the exactInvalid Client Modebody;ConfigDump;versionInfo: v2.The ads-mode cases build the controller via
ads.NewController(nil)(the same constructionpkg/controller/adstests already use), so they exercise the real in-memoryAdsCachewithout needing any bpf map — mirroring howTestServer_configDumpWorkloadtests the dual-engine analogue.Only
pkg/status/status_server_test.gois changed; no production code is touched. The new tests are inserted next to the related existing tests (rather than appended at the end of the file) to keep the file grouped by handler and avoid conflicting with other in-flight test PRs.Which issue(s) this PR fixes:
None
Special notes for your reviewer:
authzhandler in the same file.Does this PR introduce a user-facing change?: