Fiber app.Test request-context compatibility boundary across major versions
0 reputation · 10 Jul 2024, 04:06 UTC
The goal is to decide where the integration boundary should sit for Fiber handlers that depend on request context. app.Test exercises the app stack without binding a listener, so tests can run without production credentials by injecting fakes through c.Locals. However, values such as remote address, TLS state, protocol, and hostname are normally populated by a real server and may be missing or default under in-process execution.
This boundary is version-sensitive because Fiber’s test helper, default configuration, and Ctx methods are tied to the major version resolved in go.mod. A handler branching on c.IP(), c.Secure(), c.Protocol(), or c.Hostname() might pass under app.Test in one major version and behave differently under app.Listen or another Fiber release.
No production credentials or live listener behavior should be assumed in the test fixture.
Should handler-level tests assert on request-context values under app.Test, or should those assertions be reserved for a separate local-listener smoke test? How can a team define a stable contract across Fiber major versions when context values are listener-dependent? Is there a documented compatibility boundary that separates safe app.Test coverage from listener-dependent behavior?