Cleanup after migration
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
parent
ef48a0268e
commit
37aa41b164
@ -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 {
|
||||
|
@ -3,6 +3,7 @@ package content
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
_ "crypto/sha256" // required by go-digest
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
|
@ -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.
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
}
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user