[scanner] fix: resolve Go test failures in endpoint auth, Drasi proxy, and requireUser#18330
Conversation
…xy, and requireUser Fixes #18323: Add nil guard for s.tokens in getClaudeInfo() to prevent panic in TestEndpointAuth_StatusReturnsTelemetry when tokens field is uninitialized in test helper. Fixes #18324: Inject test user ID via middleware in TestProxyDrasi_Server to satisfy auth requirements of ProxyDrasi handler (RequireEditorOrAdmin). Fixes #18325: Fix TestRequireUser to set userID as UUID in c.Locals("userID") instead of string in c.Locals("stellarUserID"), matching what resolveStellarUserID expects. All three fixes align with existing test patterns and production code contracts. Signed-off-by: GitHub Copilot <copilot@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 |
|
👋 Hey @kubestellar-hive[bot] — thanks for opening this PR!
This is an automated message. |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
Fixes #18323, Fixes #18324, Fixes #18325
Summary
s.tokensingetClaudeInfo()to prevent panic when tokens field is uninitialized in test helpers (pkg/agent/server_ai_tokens.go)TestProxyDrasi_Serverto satisfy RBAC requirements (pkg/api/handlers/mcp/drasi_proxy_test.go)TestRequireUser/valid_user_IDto set UUID inc.Locals("userID")matching whatresolveStellarUserIDexpects (pkg/api/handlers/stellar/auth_test.go)Supersedes #18328 (which has merge conflicts).