auth/oidc: test slice-typed extra claims comparison#1245
Merged
Conversation
The CI lint version (golangci-lint v2.11.4) doesn't trigger goconst on these lines, so the //nolint:goconst comments were flagged as unused by nolintlint.
Drops the heavyweight ExchangeToken-based test cases added in earlier commits on this branch. The actual change in #1238 is the claimMatches helper, which is much simpler to cover with direct unit tests. Reverts the existing oidc_test.go to its main-branch state and adds a new oidc_internal_test.go (package auth) with table-driven cases for scalar/array/[]string combinations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1238 (closes #988). Adds direct unit-test coverage for the
claimMatcheshelper, which was the actual change in #1238.claimMatchesandtoAnySliceare unexported, so the tests live inoidc_internal_test.go(package auth) — same pattern ashttp_internal_test.go. Cases covered:comparing uncomparable type []interface {}[]stringtyped slice (exercises the typed-slice branch oftoAnySlice, which[]anyskips)Test values use single letters (
x,y,p,q) rather than role labels — only the relationships matter, and short tokens keepgoconstquiet.Test plan
go test ./internal/api/handlers/v0/auth/...— all 13 subtests passgolangci-lint run ./internal/api/handlers/v0/auth/...— no new issues vs main