1
0
mirror of https://github.com/moby/moby.git synced 2025-04-18 20:44:11 +03:00
Aleksa Sarai caae3c051d
tests: migrate to assert.ErrorContains when possible
If we have an error type that we're checking a substring against, we
should really be checking using ErrorContains to indicate the right
semantics to assert.

Mostly done using these transforms:

  find . -type f -name "*_test.go" | \
    xargs gofmt -w -r 'assert.Assert(t, is.ErrorContains(e, s)) -> assert.ErrorContains(t, e, s)'
  find . -type f -name "*_test.go" | \
    xargs gofmt -w -r 'assert.Assert(t, is.Contains(err.Error(), s)) -> assert.ErrorContains(t, err, s)'
  find . -type f -name "*_test.go" | \
    xargs gofmt -w -r 'assert.Check(t, is.Contains(err.Error(), s)) -> assert.Check(t, is.ErrorContains(err, s))'

As well as some small fixups to helpers that were doing
strings.Contains explicitly.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2024-11-22 23:59:21 +11:00
..
2023-06-29 00:31:50 +02:00
2024-03-07 10:57:03 +01:00