Skip to content

credentials: add unit tests for secret validators#84

Merged
tamalsaha merged 1 commit into
masterfrom
test/credentials-unit-tests
Jun 6, 2026
Merged

credentials: add unit tests for secret validators#84
tamalsaha merged 1 commit into
masterfrom
test/credentials-unit-tests

Conversation

@tamalsaha

Copy link
Copy Markdown
Contributor

Summary

`pkg/credentials` had no tests. Add coverage for the four `validXxxSecret` helpers — most interestingly Cloudflare, whose token-vs-key+email branching is easy to break silently. Locks in the current behavior of treating a present-but-empty token key as valid; refactors that change it will need to either update the test or justify the change.

Limited to the validator surface (no envtest controller test) — those need `config/crd/bases` wiring that doesn't exist in the repo yet and are better as a follow-up.

Test plan

  • `go test ./pkg/credentials/... -v`

pkg/credentials had zero tests. Add coverage for the four
validXxxSecret helpers — most interestingly Cloudflare, whose
token-vs-key+email branch logic is easy to break silently.

Tests also lock in the current behavior of treating a present-but-empty
token key as valid; refactors that change it will now have to either
update the test or justify the change.

Signed-off-by: Tamal Saha <tamal@appscode.com>
@tamalsaha tamalsaha merged commit 209fe7e into master Jun 6, 2026
4 checks passed
@tamalsaha tamalsaha deleted the test/credentials-unit-tests branch June 6, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant