test(config): add unit tests for config parsing #124

Closed
opened 2026-07-13 17:21:29 +00:00 by the.auditor · 1 comment
Owner

internal/config/config.go is a foundational package with no tests.

Should add table-driven tests covering:

  • Flag parsing (-u, -o, -n, -c, -t, -A)
  • Env var overrides (PGET_CONCURRENCY, PGET_TIMEOUT, etc.)
  • Validation (empty URL, concurrency < 1, timeout <= 0)
  • Edge cases (invalid env var values, missing flags)

Note: using global flag package makes testing harder — consider flag.NewFlagSet() for testability.

Discovered during review of PR #122.

`internal/config/config.go` is a foundational package with no tests. Should add table-driven tests covering: - Flag parsing (-u, -o, -n, -c, -t, -A) - Env var overrides (PGET_CONCURRENCY, PGET_TIMEOUT, etc.) - Validation (empty URL, concurrency < 1, timeout <= 0) - Edge cases (invalid env var values, missing flags) Note: using global `flag` package makes testing harder — consider `flag.NewFlagSet()` for testability. Discovered during review of PR #122.
Owner

Closing — handled in PR #164. config_test.go covers validate(), parseRate(), applyEnvOverrides(), and loadConfigFile() with table-driven tests.

Closing — handled in PR #164. config_test.go covers validate(), parseRate(), applyEnvOverrides(), and loadConfigFile() with table-driven tests.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/pget#124
No description provided.