mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
tests: migrate strings.Contains -> is.Contains in assertions
Migrated using
find . -type f -name "*_test.go" |
xargs gofmt -w \
-r "assert.Check(t, strings.Contains(a, b)) -> assert.Check(t, is.Contains(a, b))"
find . -type f -name "*_test.go" |
xargs gofmt -w \
-r "assert.Assert(t, strings.Contains(a, b)) -> assert.Assert(t, is.Contains(a, b))"
Using a boolean in assert.Assert or assert.Check results in error
messages that don't contain the actual problematic string, and when
running the integration suite on an actual machine (where the source
code parsing doesn't work) this makes it almost impossible to figure out
what the actual error is.
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
@@ -96,7 +96,7 @@ func (s *DockerAPISuite) TestGetContainersWsAttachContainerNotFound(c *testing.T
|
||||
b, err := request.ReadBody(body)
|
||||
assert.NilError(c, err)
|
||||
expected := "No such container: doesnotexist"
|
||||
assert.Assert(c, strings.Contains(getErrorMessage(c, b), expected))
|
||||
assert.Assert(c, is.Contains(getErrorMessage(c, b), expected))
|
||||
}
|
||||
|
||||
func (s *DockerAPISuite) TestPostContainersAttach(c *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user