Skip to content

[quality] fix: add Host header to pkg/api + middleware test requests for fasthttp 1.72.0#19929

Closed
clubanderson wants to merge 2 commits into
mainfrom
quality/fix-host-header-remaining
Closed

[quality] fix: add Host header to pkg/api + middleware test requests for fasthttp 1.72.0#19929
clubanderson wants to merge 2 commits into
mainfrom
quality/fix-host-header-remaining

Conversation

@clubanderson

Copy link
Copy Markdown
Collaborator

Test Improvement

Adds req.Host = "localhost" after every httptest.NewRequest()/http.NewRequest() call in 11 test files across pkg/api/ (top-level) and pkg/api/middleware/ that were missed by #19925.

Root Cause

PR #19925 fixed 44 files in pkg/api/handlers/ and pkg/api/audit/, but the go test ./... CI job still fails because these additional packages also use Fiber's app.Test(req) which routes through fasthttp 1.72.0 (requires Host header).

Files Fixed

pkg/api/ (top-level):

  • routes_health_test.go
  • routes_api_core_test.go
  • routes_registration_test.go
  • routes_auth_test.go
  • routes_feedback_test.go
  • middleware_setup_test.go

pkg/api/middleware/:

  • csrf_test.go
  • websocket_origin_test.go
  • auth_ws_revoke_test.go
  • auth_test.go
  • ratelimit_test.go

Relationship 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)

…for fasthttp 1.72.0

Signed-off-by: quality-agent <quality@kubestellar.io>
Copilot AI review requested due to automatic review settings June 29, 2026 17:43
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Jun 29, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hey @clubanderson — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@github-actions

Copy link
Copy Markdown
Contributor

🐝 Hi @clubanderson! I'm kubestellar-hive[bot], an automation bot for this repo.

Trusted users — org members and contributors with write access — can mention @kubestellar-hive in a comment to trigger repo automation.
On issues, that mention queues an automated fix attempt. On pull requests, it records extra context for existing automation.
This is not an interactive Q&A bot, so mentions should be treated as requests for automation rather than a conversation.

Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies.

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 29, 2026
@netlify

netlify Bot commented Jun 29, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit 09d9218
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a42b0c00b79cf000855a9d5
😎 Deploy Preview https://deploy-preview-19929.console-deploy-preview.kubestellar.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 after httptest.NewRequest(...) in 11 test files that call app.Test(req).
  • Aligns top-level pkg/api route tests and pkg/api/middleware tests 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

@clubanderson

Copy link
Copy Markdown
Collaborator Author

Superseded by #19930 which fixes all 174 test files comprehensively (this PR only covered 11).

@clubanderson

Copy link
Copy Markdown
Collaborator Author

Closing as superseded by #19930 which is a more comprehensive fix for the same fasthttp 1.72.0 Host header issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tier/3-restricted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] go-test on main failing — fasthttp 1.72.0 dependency broke build

2 participants