srs/trunk/src
Winlin cd11a6720f
Proxy: Harden internal/env tests and add counterfeiter fakes. v7.0.144 (#4665)
- **Refactor `internal/env` for testability.** Route every
`os`/filesystem
  call in `env.go` through swappable package-level function variables
(`getEnv`, `setEnv`, `lookupEnv`, `openFile`). Split `parseEnvFile` into
a
thin file-opening wrapper plus a pure `parseEnvReader(io.Reader)` so the
  parser can be tested directly without touching disk.
- **Hermetic tests, 96.9% coverage.** Rewrite `internal/env/env_test.go`
to
install in-memory fakes via `withFakeEnv` / `withFakeOpen` helpers that
  swap the package vars and restore them on `t.Cleanup`. Tests no longer
mutate real process env or write temp `.env` files, removing a source of
flakiness under parallel test execution. New cases cover
`NewEnvironment`,
`setEnvDefault`, `loadEnvFile` error paths, and edge cases in the
parser.
- **Counterfeiter-based fake generation.** Add `counterfeiter` as a Go
tool
dependency, a `//go:generate` directive for the `Environment` interface
  (`internal/env/gen.go`), and commit the generated
  `internal/env/envfakes/fake_environment.go` so downstream packages can
test against a spec-faithful fake instead of hand-rolling stubs. Expose
  the step as `make generate`.
- **Tooling.** `scripts/proxy-utest.sh` gains a `--coverage` / `-c` flag
  that runs `go test -coverprofile=...` across `./cmd/...` and
  `./internal/...` and prints per-function coverage via `go tool cover
  -func`. The `srs-develop` skill doc is updated to include the
  regenerate-fakes step and the new coverage flag.
- **Go version.** Bump `go.mod` to Go 1.25 (required for the `go tool`
  directive used to pin the counterfeiter CLI as a tool dep).

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 20:33:07 -04:00
..
app HLS/DASH: Fix dispose() to cleanup files after unpublish (#4618) 2026-02-03 19:36:11 -05:00
core Proxy: Harden internal/env tests and add counterfeiter fakes. v7.0.144 (#4665) 2026-04-18 20:33:07 -04:00
kernel DVR: Fix HEVC mp4 recording error. v7.0.135 (#4604) (#4604) 2025-12-06 19:49:13 -05:00
main Add ignore configuration for cursor. v7.0.115 (#4547) 2025-10-31 19:11:51 -04:00
protocol SRT: Support default_mode config for short streamid format. v7.0.131 (#4598) 2025-11-30 16:26:04 -05:00
utest HLS/DASH: Fix dispose() to cleanup files after unpublish (#4618) 2026-02-03 19:36:11 -05:00