Documentation
¶
Overview ¶
Package testutil provides shared helpers for isolated test fixtures. Production code must not depend on this package.
Index ¶
Constants ¶
const RequireSymlinksEnv = "CONTROL_TEST_REQUIRE_SYMLINKS"
RequireSymlinksEnv declares that the test runner has been provisioned for symbolic-link creation. It is not inferred from CI or administrator status.
Variables ¶
This section is empty.
Functions ¶
func Symlink ¶
Symlink creates a fixture link or ends the current test. Unprovisioned environments skip only recognized missing-capability errors; unexpected errors always fail. A true RequireSymlinksEnv makes every creation error fail. No privileges, Developer Mode or filesystem settings are changed.
func TLSServer ¶ added in v0.9.1
func TLSServer(t testing.TB, handler http.Handler, hosts ...string) (*httptest.Server, *x509.CertPool)
TLSServer serves handler with a leaf certificate for hosts, 127.0.0.1, and ::1, issued by a fresh test CA. Callers trust the returned pool explicitly; certificate verification stays enabled.
Types ¶
type ConnectProxy ¶ added in v0.9.1
type ConnectProxy struct {
URL string
// contains filtered or unexported fields
}
ConnectProxy is a minimal CONNECT-only HTTP proxy for gateway route tests. It forwards only allowlisted targets, resolving them itself, so a child that cannot resolve or reach the gateway can still connect through it.
func NewConnectProxy ¶ added in v0.9.1
func NewConnectProxy(t testing.TB, resolve map[string]string) *ConnectProxy
NewConnectProxy maps CONNECT host:port targets to dial addresses. Any other target is refused with 403, like a proxy with a destination allowlist.
func (*ConnectProxy) Close ¶ added in v0.9.1
func (p *ConnectProxy) Close()
Close stops the listener and every tunnel, simulating a proxy outage.
func (*ConnectProxy) PlaintextRequests ¶ added in v0.9.1
func (p *ConnectProxy) PlaintextRequests() int
PlaintextRequests counts non-CONNECT requests, without retaining their headers or bodies. Gateway credentials must never reach this path.
func (*ConnectProxy) Targets ¶ added in v0.9.1
func (p *ConnectProxy) Targets() []string
Targets returns every CONNECT target requested so far, including refused ones.