@@ -32,7 +32,7 @@ import (
|
||||
|
||||
"github.com/containerd/continuity/fs/fstest"
|
||||
"github.com/sirupsen/logrus"
|
||||
"gotest.tools/v3/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/containerd/containerd/mount"
|
||||
"github.com/containerd/containerd/snapshots"
|
||||
@@ -64,14 +64,14 @@ func BenchmarkNative(b *testing.B) {
|
||||
}
|
||||
|
||||
snapshotter, err := native.NewSnapshotter(nativeRootPath)
|
||||
assert.NilError(b, err)
|
||||
assert.Nil(b, err)
|
||||
|
||||
defer func() {
|
||||
err = snapshotter.Close()
|
||||
assert.NilError(b, err)
|
||||
assert.Nil(b, err)
|
||||
|
||||
err = os.RemoveAll(nativeRootPath)
|
||||
assert.NilError(b, err)
|
||||
assert.Nil(b, err)
|
||||
}()
|
||||
|
||||
benchmarkSnapshotter(b, snapshotter)
|
||||
@@ -83,14 +83,14 @@ func BenchmarkOverlay(b *testing.B) {
|
||||
}
|
||||
|
||||
snapshotter, err := overlay.NewSnapshotter(overlayRootPath)
|
||||
assert.NilError(b, err, "failed to create overlay snapshotter")
|
||||
assert.Nil(b, err, "failed to create overlay snapshotter")
|
||||
|
||||
defer func() {
|
||||
err = snapshotter.Close()
|
||||
assert.NilError(b, err)
|
||||
assert.Nil(b, err)
|
||||
|
||||
err = os.RemoveAll(overlayRootPath)
|
||||
assert.NilError(b, err)
|
||||
assert.Nil(b, err)
|
||||
}()
|
||||
|
||||
benchmarkSnapshotter(b, snapshotter)
|
||||
@@ -114,17 +114,17 @@ func BenchmarkDeviceMapper(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
|
||||
snapshotter, err := devmapper.NewSnapshotter(ctx, config)
|
||||
assert.NilError(b, err)
|
||||
assert.Nil(b, err)
|
||||
|
||||
defer func() {
|
||||
err := snapshotter.ResetPool(ctx)
|
||||
assert.NilError(b, err)
|
||||
assert.Nil(b, err)
|
||||
|
||||
err = snapshotter.Close()
|
||||
assert.NilError(b, err)
|
||||
assert.Nil(b, err)
|
||||
|
||||
err = os.RemoveAll(dmRootPath)
|
||||
assert.NilError(b, err)
|
||||
assert.Nil(b, err)
|
||||
}()
|
||||
|
||||
benchmarkSnapshotter(b, snapshotter)
|
||||
@@ -184,19 +184,19 @@ func benchmarkSnapshotter(b *testing.B, snapshotter snapshots.Snapshotter) {
|
||||
|
||||
timer = time.Now()
|
||||
mounts, err := snapshotter.Prepare(ctx, current, parent)
|
||||
assert.NilError(b, err)
|
||||
assert.Nil(b, err)
|
||||
prepareDuration += time.Since(timer)
|
||||
|
||||
timer = time.Now()
|
||||
err = mount.WithTempMount(ctx, mounts, layers[l].Apply)
|
||||
assert.NilError(b, err)
|
||||
assert.Nil(b, err)
|
||||
writeDuration += time.Since(timer)
|
||||
|
||||
parent = fmt.Sprintf("committed-%d", atomic.AddInt64(&layerIndex, 1))
|
||||
|
||||
timer = time.Now()
|
||||
err = snapshotter.Commit(ctx, parent, current)
|
||||
assert.NilError(b, err)
|
||||
assert.Nil(b, err)
|
||||
commitDuration += time.Since(timer)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user