-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Replace deprecated usages of assert.ErrorType
#5312
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,6 @@ import ( | |
| "github.com/docker/cli/cli/config/configfile" | ||
| "github.com/docker/docker/errdefs" | ||
| "gotest.tools/v3/assert" | ||
| is "gotest.tools/v3/assert/cmp" | ||
| ) | ||
|
|
||
| func TestRemove(t *testing.T) { | ||
|
|
@@ -18,7 +17,7 @@ func TestRemove(t *testing.T) { | |
| _, err := cli.ContextStore().GetMetadata("current") | ||
| assert.NilError(t, err) | ||
| _, err = cli.ContextStore().GetMetadata("other") | ||
| assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) | ||
| assert.Check(t, errdefs.IsNotFound(err)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To keep the current (more informative) output of
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh, yeah I just saw you mention the nicer output (I definitely wondered why we were using
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we want to continue using the |
||
| } | ||
|
|
||
| func TestRemoveNotAContext(t *testing.T) { | ||
|
|
||
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.
Oh! I recall some fun cases where there's no good replacement, or at least
errors.As/errors.Isfor sure has a bunch of pitfalls; see the discussion I had with the gotest.tools authors on gotestyourself/gotest.tools#272There 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.
Indeed. This works, but the
errors.As"pointer-to-pointer" stuff is.. not nice to use.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.
It's really horrible, and very easy to get wrong (in which case, it's even possible to get the unexpected result). I honestly really hate the
errors.As/errors.Ishandling for that reason.