Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor API tests #483

Merged
merged 2 commits into from Mar 18, 2022
Merged

Refactor API tests #483

merged 2 commits into from Mar 18, 2022

Conversation

haydentherapper
Copy link
Contributor

Summary

This refactor adds tests for all supported OIDC types, and makes it
simpler to add new tests for new OIDC types.

  • Add tests for K8s and GitHub OIDC types.
  • Add additional verification for issued certificate values
  • Add dedicated test for RootCert success, don't call RootCert in every test.
  • Move common expectations to function. This provides a single place to
    check response values.
  • Move common set up to dedicated functions.
  • Lowercase all error messages, because style.

Once #463 is submitted, I'll rebase.

Signed-off-by: Hayden Blauzvern hblauzvern@google.com

Ticket Link

Fixes

Release Note

NONE

This implements the second part of sigstore#398, adding support for OIDC
subjects that are simply usernames. A configured domain will be appended
to the username and included as a SAN email address.

Like sigstore#455, token issuers must partially match the configured domain. The
top level and second level domain must match, and it's expected that we
validate ownership for what's configured in the issuer and domain
fields.

Signed-off-by: Hayden Blauzvern <hblauzvern@google.com>
This refactor adds tests for all supported OIDC types, and makes it
simpler to add new tests for new OIDC types.

* Add tests for K8s and GitHub OIDC types.
* Add additional verification for issued certificate values
* Add dedicated test for RootCert success, don't call RootCert in every test.
* Move common expectations to function. This provides a single place to
  check response values.
* Move common set up to dedicated functions.
* Lowercase all error messages, because style.

Signed-off-by: Hayden Blauzvern <hblauzvern@google.com>
@codecov-commenter
Copy link

Codecov Report

Merging #483 (a87f0f4) into main (8bc09cf) will increase coverage by 0.75%.
The diff coverage is 55.88%.

@@            Coverage Diff             @@
##             main     #483      +/-   ##
==========================================
+ Coverage   46.87%   47.63%   +0.75%     
==========================================
  Files          14       14              
  Lines        1024     1056      +32     
==========================================
+ Hits          480      503      +23     
- Misses        476      480       +4     
- Partials       68       73       +5     
Impacted Files Coverage Δ
pkg/config/config.go 51.90% <ø> (ø)
pkg/challenges/challenges.go 22.18% <53.12%> (+3.40%) ⬆️
pkg/api/ca.go 50.56% <100.00%> (+3.97%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8bc09cf...a87f0f4. Read the comment docs.

@dlorenc dlorenc merged commit 6d1ff56 into sigstore:main Mar 18, 2022
@haydentherapper haydentherapper deleted the test-cleanup branch March 18, 2022 17:05
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.

None yet

3 participants