Skip to content

Use testify assertions in pkg/errorutil/errors_test.go for consistent table-test failures#35776

Merged
pelikhan merged 3 commits into
mainfrom
copilot/testify-expert-improve-test-quality-another-one
May 29, 2026
Merged

Use testify assertions in pkg/errorutil/errors_test.go for consistent table-test failures#35776
pelikhan merged 3 commits into
mainfrom
copilot/testify-expert-improve-test-quality-another-one

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 29, 2026

pkg/errorutil/errors_test.go used manual t.Errorf checks while the same package already uses testify assertions in sibling tests. This PR aligns assertion style across errorutil and improves failure readability in table-driven subtests.

  • Assertion style alignment

    • Added github.com/stretchr/testify/assert import in pkg/errorutil/errors_test.go.
    • Replaced all manual equality checks (if got != tt.want { t.Errorf(...) }) with assert.Equal(...).
  • Scope of updates

    • Updated all three table-driven test suites:
      • TestIsNotFoundError
      • TestIsForbiddenError
      • TestIsGoneError
    • Included descriptive assertion messages with subtest context via tt.name.
  • Representative change

    got := errorutil.IsForbiddenError(tt.err)
    assert.Equal(t, tt.want, got, "IsForbiddenError result mismatch for subtest %s", tt.name)

Copilot AI and others added 2 commits May 29, 2026 19:38
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve test quality in pkg/errorutil/errors_test.go Use testify assertions in pkg/errorutil/errors_test.go for consistent table-test failures May 29, 2026
Copilot AI requested a review from gh-aw-bot May 29, 2026 19:42
@pelikhan pelikhan marked this pull request as ready for review May 29, 2026 19:58
Copilot AI review requested due to automatic review settings May 29, 2026 19:58
@pelikhan pelikhan merged commit 080c884 into main May 29, 2026
1 check failed
@pelikhan pelikhan deleted the copilot/testify-expert-improve-test-quality-another-one branch May 29, 2026 19:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

[testify-expert] Improve Test Quality: pkg/errorutil/errors_test.go

4 participants