-
Notifications
You must be signed in to change notification settings - Fork 519
Fix tests for root not found by fingerprint #2525
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
Conversation
Broken test was merged as part of #1893.
c45fd49 to
979edbb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes broken tests related to root certificate not found error messages that were introduced in PR #1893. The tests were failing due to incorrect expected error message strings.
Changes
- Updated expected error messages in tests to match the actual error format returned by the code
- Fixed string escaping in test assertions to properly match quoted fingerprints in error messages
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ca/ca_test.go | Updated expected error message from generic default to specific fingerprint-based message |
| api/api_test.go | Fixed string escaping in error message assertion to properly match quoted fingerprint |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }{ | ||
| {"ok", parseCertificate(rootPEM), nil, "", 200}, | ||
| {"fail", nil, fmt.Errorf("not found"), fmt.Sprintf("root certificate with fingerprint %q was not found", sha), 404}, | ||
| {"fail", nil, fmt.Errorf("not found"), fmt.Sprintf(`root certificate with fingerprint \"%s\" was not found`, sha), 404}, |
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The manual escaping of quotes with backslashes is unnecessary and makes the test harder to read. Since the format string is already using backticks (raw string literal), you can include the quotes directly without escaping: root certificate with fingerprint \"%s\" was not found should be root certificate with fingerprint \"%s\" was not found or use double quotes with proper escaping if needed based on how the actual error message is formatted.
| {"fail", nil, fmt.Errorf("not found"), fmt.Sprintf(`root certificate with fingerprint \"%s\" was not found`, sha), 404}, | |
| {"fail", nil, fmt.Errorf("not found"), fmt.Sprintf(`root certificate with fingerprint "%s" was not found`, sha), 404}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but that is the wrong conclusion, Copilot.
tashian
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Broken test was merged as part of #1893.