Fix tests that failed when using cmp.Compare()
internal/test/testutil/assert
InDelta
Fix DeepEqual with kube metav1.Time
Convert some ErrorContains to assert
Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit 5155cda716)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
20 lines
449 B
Go
20 lines
449 B
Go
package testutil
|
|
|
|
import (
|
|
"github.com/gotestyourself/gotestyourself/assert"
|
|
)
|
|
|
|
type helperT interface {
|
|
Helper()
|
|
}
|
|
|
|
// ErrorContains checks that the error is not nil, and contains the expected
|
|
// substring.
|
|
// Deprecated: use assert.Assert(t, cmp.ErrorContains(err, expected))
|
|
func ErrorContains(t assert.TestingT, err error, expectedError string) {
|
|
if ht, ok := t.(helperT); ok {
|
|
ht.Helper()
|
|
}
|
|
assert.ErrorContains(t, err, expectedError)
|
|
}
|