[quality] fix: add Host header to pkg/api + middleware test requests for fasthttp 1.72.0#19929
[quality] fix: add Host header to pkg/api + middleware test requests for fasthttp 1.72.0#19929clubanderson wants to merge 2 commits into
Conversation
…for fasthttp 1.72.0 Signed-off-by: quality-agent <quality@kubestellar.io>
|
[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 @clubanderson — thanks for opening this PR!
This is an automated message. |
|
🐝 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. |
✅ Deploy Preview for kubestellarconsole ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR addresses Go test failures introduced by the fasthttp 1.72.0 upgrade by ensuring Fiber app.Test(req) requests include a Host value in additional pkg/api and pkg/api/middleware test packages that were missed by #19925.
Changes:
- Set
req.Host = "localhost"immediately afterhttptest.NewRequest(...)in 11 test files that callapp.Test(req). - Aligns top-level
pkg/apiroute tests andpkg/api/middlewaretests with the same Host-header workaround already applied in handler/audit tests.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/api/routes_registration_test.go | Adds req.Host to route registration tests that call server.app.Test(req) |
| pkg/api/routes_health_test.go | Adds req.Host to health/version endpoint tests using server.app.Test(req) |
| pkg/api/routes_feedback_test.go | Adds req.Host to feedback route tests using app.Test(req) |
| pkg/api/routes_auth_test.go | Adds req.Host to auth route registration loop tests using s.app.Test(req, -1) |
| pkg/api/routes_api_core_test.go | Adds req.Host to core API route test using app.Test(req) |
| pkg/api/middleware_setup_test.go | Adds req.Host to CSP/XFO middleware setup tests using s.app.Test(req) |
| pkg/api/middleware/websocket_origin_test.go | Adds req.Host to websocket origin middleware tests using app.Test(req, -1) |
| pkg/api/middleware/ratelimit_test.go | Adds req.Host to ratelimit composite-key tests using app.Test(req) |
| pkg/api/middleware/csrf_test.go | Adds req.Host to CSRF middleware tests using app.Test(req) |
| pkg/api/middleware/auth_ws_revoke_test.go | Adds req.Host to websocket origin/revocation tests using app.Test(req, 5000) |
| pkg/api/middleware/auth_test.go | Adds req.Host to JWT auth middleware tests covering many app.Test(req, ...) paths |
|
Superseded by #19930 which fixes all 174 test files comprehensively (this PR only covered 11). |
|
Closing as superseded by #19930 which is a more comprehensive fix for the same fasthttp 1.72.0 Host header issue. |
Test Improvement
Adds
req.Host = "localhost"after everyhttptest.NewRequest()/http.NewRequest()call in 11 test files acrosspkg/api/(top-level) andpkg/api/middleware/that were missed by #19925.Root Cause
PR #19925 fixed 44 files in
pkg/api/handlers/andpkg/api/audit/, but thego test ./...CI job still fails because these additional packages also use Fiber'sapp.Test(req)which routes through fasthttp 1.72.0 (requires Host header).Files Fixed
pkg/api/ (top-level):
routes_health_test.goroutes_api_core_test.goroutes_registration_test.goroutes_auth_test.goroutes_feedback_test.gomiddleware_setup_test.gopkg/api/middleware/:
csrf_test.gowebsocket_origin_test.goauth_ws_revoke_test.goauth_test.goratelimit_test.goRelationship to #19925
This PR supplements #19925. Together they provide the complete fix for all test files that use
app.Test(). Both PRs should be merged to fully resolve the go-test failure on main.Fixes #19909
Filed by quality agent (ACMM L4/L6 — full mode)