test(errorutil): improve edge-case coverage and reduce assertion noise#46366
Merged
pelikhan merged 2 commits intoJul 18, 2026
Merged
Conversation
6 tasks
- Add file-header scope comments to errors_test.go and spec_test.go - Remove redundant failure-message format strings from all three table loops - Add double-wrapped error cases to TestIsNotFoundError, TestIsForbiddenError, TestIsGoneError - Add boundary value cases (exact "404", partial "404abc") to TestIsNotFoundError Closes #46291 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve test quality for errorutil tests
test(errorutil): improve edge-case coverage and reduce assertion noise
Jul 18, 2026
pelikhan
marked this pull request as ready for review
July 18, 2026 08:09
Contributor
There was a problem hiding this comment.
Pull request overview
Improves errorutil edge-case coverage and clarifies test-file responsibilities.
Changes:
- Adds boundary and double-wrapped error cases.
- Removes redundant assertion messages.
- Documents behavioral versus API-contract test scope.
Show a summary per file
| File | Description |
|---|---|
pkg/errorutil/errors_test.go |
Expands classifier coverage and simplifies assertions. |
pkg/errorutil/spec_test.go |
Documents responsibility for README-backed contract tests. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Medium
pelikhan
deleted the
copilot/testify-expert-improve-test-quality-yet-again
branch
July 18, 2026 08:47
This was referenced Jul 18, 2026
Contributor
|
🎉 This pull request is included in a new release. Release: |
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.
pkg/errorutil/errors_test.golacked double-wrapped error cases, boundary inputs forIsNotFoundError, and carried redundant per-assertion failure messages that duplicatedt.Runlabels. File-level comments were also absent, making the split of responsibility betweenerrors_test.goandspec_test.goimplicit.Changes
errors_test.goTestIsNotFoundError: exact"404"(no surrounding text) and partial-prefix"404abc"— both should returntrueand were previously untested.fmt.Errorf("%w", fmt.Errorf("%w", ...))) added to all three table-driven tests to cover two levels of wrapping, not just one.assert.Equalcalls — the subtest name is already surfaced byt.Runin failure output.spec_test.go