@@ -26,8 +26,7 @@ import (
|
||||
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/opencontainers/go-digest"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type copySource struct {
|
||||
@@ -81,9 +80,9 @@ func TestCopy(t *testing.T) {
|
||||
testcase.source.size,
|
||||
testcase.source.digest)
|
||||
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal(testcase.source.digest, testcase.writer.committedDigest))
|
||||
assert.Check(t, is.Equal(testcase.expected, testcase.writer.String()))
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, testcase.source.digest, testcase.writer.committedDigest)
|
||||
assert.Equal(t, testcase.expected, testcase.writer.String())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,16 @@ package local
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gotest.tools/v3/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestTryLock(t *testing.T) {
|
||||
err := tryLock("testref")
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
defer unlock("testref")
|
||||
|
||||
err = tryLock("testref")
|
||||
assert.ErrorContains(t, err, "ref testref locked for ")
|
||||
require.NotNil(t, err)
|
||||
assert.Contains(t, err.Error(), "ref testref locked for ")
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import (
|
||||
|
||||
"github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"gotest.tools/v3/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type memoryLabelStore struct {
|
||||
@@ -351,7 +351,7 @@ func checkWrite(ctx context.Context, t checker, cs content.Store, dgst digest.Di
|
||||
|
||||
func TestWriterTruncateRecoversFromIncompleteWrite(t *testing.T) {
|
||||
cs, err := NewStore(t.TempDir())
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
@@ -362,26 +362,26 @@ func TestWriterTruncateRecoversFromIncompleteWrite(t *testing.T) {
|
||||
setupIncompleteWrite(ctx, t, cs, ref, total)
|
||||
|
||||
writer, err := cs.Writer(ctx, content.WithRef(ref), content.WithDescriptor(ocispec.Descriptor{Size: total}))
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.NilError(t, writer.Truncate(0))
|
||||
assert.Nil(t, writer.Truncate(0))
|
||||
|
||||
_, err = writer.Write(contentB)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
dgst := digest.FromBytes(contentB)
|
||||
err = writer.Commit(ctx, total, dgst)
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func setupIncompleteWrite(ctx context.Context, t *testing.T, cs content.Store, ref string, total int64) {
|
||||
writer, err := cs.Writer(ctx, content.WithRef(ref), content.WithDescriptor(ocispec.Descriptor{Size: total}))
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = writer.Write([]byte("bad data"))
|
||||
assert.NilError(t, err)
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.NilError(t, writer.Close())
|
||||
assert.Nil(t, writer.Close())
|
||||
}
|
||||
|
||||
func TestWriteReadEmptyFileTimestamp(t *testing.T) {
|
||||
|
||||
@@ -32,9 +32,9 @@ import (
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/log/logtest"
|
||||
"github.com/containerd/containerd/pkg/testutil"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"gotest.tools/v3/assert"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -271,7 +271,7 @@ func checkResumeWriter(ctx context.Context, t *testing.T, cs content.Store) {
|
||||
}
|
||||
|
||||
checkStatus(t, w1, expected, dgstFirst, preStart, postStart, preUpdate, postUpdate)
|
||||
assert.NilError(t, w1.Close(), "close first writer")
|
||||
assert.Nil(t, w1.Close(), "close first writer")
|
||||
|
||||
w2, err := cs.Writer(ctx, content.WithRef(ref), content.WithDescriptor(ocispec.Descriptor{Size: 256, Digest: dgst}))
|
||||
if err != nil {
|
||||
@@ -295,7 +295,7 @@ func checkResumeWriter(ctx context.Context, t *testing.T, cs content.Store) {
|
||||
}
|
||||
postCommit := time.Now()
|
||||
|
||||
assert.NilError(t, w2.Close(), "close second writer")
|
||||
assert.Nil(t, w2.Close(), "close second writer")
|
||||
info := content.Info{
|
||||
Digest: dgst,
|
||||
Size: 256,
|
||||
|
||||
Reference in New Issue
Block a user