diff --git a/cio/io_test.go b/cio/io_test.go index 6bb425b5c..40e5cc071 100644 --- a/cio/io_test.go +++ b/cio/io_test.go @@ -44,7 +44,7 @@ func TestNewFIFOSetInDir(t *testing.T) { assert.Check(t, is.Equal("theid-stdin", filepath.Base(fifos.Stdin))) assert.Check(t, is.Equal("theid-stdout", filepath.Base(fifos.Stdout))) assert.Check(t, is.Equal("theid-stderr", filepath.Base(fifos.Stderr))) - assert.Check(t, is.Equal(true, fifos.Terminal)) + assert.Check(t, fifos.Terminal) files, err := ioutil.ReadDir(root) assert.NilError(t, err) @@ -89,11 +89,11 @@ func TestNewAttach(t *testing.T) { io.Wait() io.Cancel() - assert.Check(t, is.NilError(io.Close())) + assert.NilError(t, io.Close()) - assert.Check(t, is.Equal(expectedStdout, stdout.String())) - assert.Check(t, is.Equal(expectedStderr, stderr.String())) - assert.Check(t, is.Equal(expectedStdin, string(actualStdin))) + assert.Check(t, is.EqualMultiLine(expectedStdout, stdout.String())) + assert.Check(t, is.EqualMultiLine(expectedStderr, stderr.String())) + assert.Check(t, is.EqualMultiLine(expectedStdin, string(actualStdin))) } type producers struct { diff --git a/content/helpers_test.go b/content/helpers_test.go index f93860cd9..239eb9dc1 100644 --- a/content/helpers_test.go +++ b/content/helpers_test.go @@ -3,6 +3,7 @@ package content import ( "bytes" "context" + _ "crypto/sha256" // required by go-digest "io" "strings" "testing" diff --git a/log/context_test.go b/log/context_test.go index 2c3712233..762afa561 100644 --- a/log/context_test.go +++ b/log/context_test.go @@ -5,15 +5,14 @@ import ( "testing" "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" ) func TestLoggerContext(t *testing.T) { ctx := context.Background() - assert.Check(t, is.DeepEqual(GetLogger(ctx), L)) // should be same as L variable - assert.Check(t, is.DeepEqual(G(ctx), GetLogger(ctx))) // these should be the same. + assert.Equal(t, GetLogger(ctx), L) // should be same as L variable + assert.Equal(t, G(ctx), GetLogger(ctx)) // these should be the same. ctx = WithLogger(ctx, G(ctx).WithField("test", "one")) - assert.Check(t, is.DeepEqual(GetLogger(ctx).Data["test"], "one")) - assert.Check(t, is.DeepEqual(G(ctx), GetLogger(ctx))) // these should be the same. + assert.Equal(t, GetLogger(ctx).Data["test"], "one") + assert.Equal(t, G(ctx), GetLogger(ctx)) // these should be the same. } diff --git a/snapshots/testsuite/testsuite.go b/snapshots/testsuite/testsuite.go index 75eedb202..698c9c3fb 100644 --- a/snapshots/testsuite/testsuite.go +++ b/snapshots/testsuite/testsuite.go @@ -422,7 +422,6 @@ func checkSnapshotterPrepareView(ctx context.Context, t *testing.T, snapshotter } _, err = snapshotter.View(ctx, newLayer, snapA, opt) - //must be err != nil assert.Check(t, err != nil) // Two Prepare with same key @@ -437,7 +436,6 @@ func checkSnapshotterPrepareView(ctx context.Context, t *testing.T, snapshotter } _, err = snapshotter.Prepare(ctx, prepLayer, snapA, opt) - //must be err != nil assert.Check(t, err != nil) // Two View with same key @@ -452,7 +450,6 @@ func checkSnapshotterPrepareView(ctx context.Context, t *testing.T, snapshotter } _, err = snapshotter.View(ctx, viewLayer, snapA, opt) - //must be err != nil assert.Check(t, err != nil) } diff --git a/testutil/helpers_unix.go b/testutil/helpers_unix.go index 3cf1bb820..cc8eac023 100644 --- a/testutil/helpers_unix.go +++ b/testutil/helpers_unix.go @@ -9,15 +9,13 @@ import ( "github.com/containerd/containerd/mount" "github.com/gotestyourself/gotestyourself/assert" - is "github.com/gotestyourself/gotestyourself/assert/cmp" ) // Unmount unmounts a given mountPoint and sets t.Error if it fails func Unmount(t *testing.T, mountPoint string) { t.Log("unmount", mountPoint) - if err := mount.UnmountAll(mountPoint, umountflags); err != nil { - t.Error("Could not umount", mountPoint, err) - } + err := mount.UnmountAll(mountPoint, umountflags) + assert.NilError(t, err) } // RequiresRoot skips tests that require root, unless the test.root flag has @@ -25,9 +23,8 @@ func Unmount(t *testing.T, mountPoint string) { func RequiresRoot(t testing.TB) { if !rootEnabled { t.Skip("skipping test that requires root") - return } - assert.Check(t, is.Equal(0, os.Getuid()), "This test must be run as root.") + assert.Equal(t, 0, os.Getuid(), "This test must be run as root.") } // RequiresRootM is similar to RequiresRoot but intended to be called from *testing.M.