[quality] add unit tests for server_routes.go, shell_unix.go, and init.go#19940
Conversation
Signed-off-by: clubanderson <clubanderson@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tests resolveShell, shellFlag, isWindows on Unix platforms. Signed-off-by: clubanderson <clubanderson@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verifies that init() correctly wires up ai.GetRegistry, ai.InitializeProviders, ai.SetClusterContextProviders, and ai.GetConfigManager function pointers. Signed-off-by: clubanderson <clubanderson@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Deploy Preview for kubestellarconsole canceled.
|
|
[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 |
|
🐝 Hi @clubanderson! I'm Trusted users — org members and contributors with write access — can mention Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies. |
|
👋 Hey @clubanderson — thanks for opening this PR!
This is an automated message. |
There was a problem hiding this comment.
Pull request overview
Adds new unit tests to increase pkg/agent coverage for route registration, Unix shell resolution helpers, and pkg/ai function-pointer wiring via init().
Changes:
- Adds Unix-only tests validating
resolveShell(),shellFlag(),isWindows(), anderrNoShellFoundbehavior. - Adds tests around
Server.registerRoutes()including catch-all behavior (404/OPTIONS). - Adds tests verifying
init()wirespkg/aifunction pointers and that key accessors return non-nil values.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/agent/server_routes_test.go | New tests intended to validate route registration and catch-all behavior for the agent HTTP mux. |
| pkg/agent/shell_unix_test.go | New Unix-only tests for shell detection and platform helpers. |
| pkg/agent/init_test.go | New tests verifying init() wiring between pkg/agent and pkg/ai via function pointers. |
| req := httptest.NewRequest(http.MethodGet, route, nil) | ||
| // ServeMux.Handler returns the handler and the matched pattern. | ||
| _, pattern := mux.Handler(req) | ||
| if pattern == "" { | ||
| t.Errorf("route %q is not registered in registerRoutes", route) | ||
| } |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
⏹️ Post-Merge Verification: cancelledCommit: |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
Test Improvement
Adds 17 test cases across 3 new test files for the remaining untested files in
pkg/agentidentified in #19907:server_routes_test.go(4 tests)registerRoutes— catches accidentally dropped routes during refactors/handler returns 404 for unregistered pathsshell_unix_test.go(5 tests)init_test.go(4 tests + 4 sub-checks)These tests cover
server_routes.go,shell.go,shell_unix.go, andinit.go— the remaining 4 files from #19907 not addressed by PR #19937 (compat files) or the provider test PRs.Partially addresses #19907
Filed by quality agent (ACMM L4/L6 — full mode)