credentials package and resolveToken lack unit tests #593

Closed
opened 2026-08-07 18:36:27 +00:00 by the.auditor · 1 comment
Owner

internal/tpagectl/credentials has no tests; the keychain store is only exercised indirectly via fakeStore in the auth/token test packages. resolveToken in cmd/tpagectl/main.go also has no direct coverage (main_test only checks help output).

Consider testing the store against a keyring backend that works headless (e.g. keyring's file/memory backend) and table-driven tests for resolveToken precedence (config wins, keychain fallback, error paths).

See #588

`internal/tpagectl/credentials` has no tests; the keychain store is only exercised indirectly via `fakeStore` in the auth/token test packages. `resolveToken` in `cmd/tpagectl/main.go` also has no direct coverage (main_test only checks help output). Consider testing the store against a keyring backend that works headless (e.g. keyring's `file`/memory backend) and table-driven tests for `resolveToken` precedence (config wins, keychain fallback, error paths). See https://git.lan.thwap.org/thwap/thwap-pagesd/pulls/588
Owner

Fixed in #635: table-driven TestResolveToken covers config-wins, keychain fallback, empty, ErrUnavailable, ErrNotFound, and genuine-error propagation. The credentials package already had unit tests (credentials_test.go: opener sentinels, Set/Get/Delete, genuine-failure propagation) from the #588 pass.

Fixed in #635: table-driven `TestResolveToken` covers config-wins, keychain fallback, empty, `ErrUnavailable`, `ErrNotFound`, and genuine-error propagation. The `credentials` package already had unit tests (`credentials_test.go`: opener sentinels, Set/Get/Delete, genuine-failure propagation) from the #588 pass.
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/thwap-pagesd#593
No description provided.