Move DefaultSnapshotter constants
Move the DefaultSnapshotter constants to the defaults package. Fixes issue #8226. Signed-off-by: James Jenkins <James.Jenkins@ibm.com>
This commit is contained in:
@@ -23,7 +23,6 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
containerd "github.com/containerd/containerd/v2/client"
|
||||
"github.com/containerd/containerd/v2/defaults"
|
||||
"github.com/containerd/containerd/v2/namespaces"
|
||||
"github.com/containerd/log/logtest"
|
||||
@@ -37,7 +36,7 @@ const (
|
||||
var (
|
||||
address string
|
||||
ctrdStdioFilePath string
|
||||
testSnapshotter = containerd.DefaultSnapshotter
|
||||
testSnapshotter = defaults.DefaultSnapshotter
|
||||
ctrd = &daemon{}
|
||||
)
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ func TestMain(m *testing.M) {
|
||||
"snapshotter": os.Getenv("TEST_SNAPSHOTTER"),
|
||||
}).Info("running tests against containerd")
|
||||
|
||||
snapshotter := DefaultSnapshotter
|
||||
snapshotter := defaults.DefaultSnapshotter
|
||||
if ss := os.Getenv("TEST_SNAPSHOTTER"); ss != "" {
|
||||
snapshotter = ss
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"testing"
|
||||
|
||||
. "github.com/containerd/containerd/v2/client"
|
||||
"github.com/containerd/containerd/v2/defaults"
|
||||
"github.com/containerd/containerd/v2/errdefs"
|
||||
"github.com/containerd/containerd/v2/images"
|
||||
imagelist "github.com/containerd/containerd/v2/integration/images"
|
||||
@@ -57,7 +58,7 @@ func TestImageIsUnpacked(t *testing.T) {
|
||||
}
|
||||
|
||||
// Check that image is not unpacked
|
||||
unpacked, err := image.IsUnpacked(ctx, DefaultSnapshotter)
|
||||
unpacked, err := image.IsUnpacked(ctx, defaults.DefaultSnapshotter)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -66,11 +67,11 @@ func TestImageIsUnpacked(t *testing.T) {
|
||||
}
|
||||
|
||||
// Check that image is unpacked
|
||||
err = image.Unpack(ctx, DefaultSnapshotter)
|
||||
err = image.Unpack(ctx, defaults.DefaultSnapshotter)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
unpacked, err = image.IsUnpacked(ctx, DefaultSnapshotter)
|
||||
unpacked, err = image.IsUnpacked(ctx, defaults.DefaultSnapshotter)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -218,7 +219,7 @@ func TestImageUsage(t *testing.T) {
|
||||
t.Fatalf("Expected actual usage to equal manifest reported usage of %d: got %d", s3, s)
|
||||
}
|
||||
|
||||
err = image.Unpack(ctx, DefaultSnapshotter)
|
||||
err = image.Unpack(ctx, defaults.DefaultSnapshotter)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -256,12 +257,12 @@ func TestImageSupportedBySnapshotter_Error(t *testing.T) {
|
||||
_, err = client.Pull(ctx, unsupportedImage,
|
||||
WithSchema1Conversion,
|
||||
WithPlatform(platforms.DefaultString()),
|
||||
WithPullSnapshotter(DefaultSnapshotter),
|
||||
WithPullSnapshotter(defaults.DefaultSnapshotter),
|
||||
WithPullUnpack,
|
||||
WithUnpackOpts([]UnpackOpt{WithSnapshotterPlatformCheck()}),
|
||||
)
|
||||
|
||||
if err == nil {
|
||||
t.Fatalf("expected unpacking %s for snapshotter %s to fail", unsupportedImage, DefaultSnapshotter)
|
||||
t.Fatalf("expected unpacking %s for snapshotter %s to fail", unsupportedImage, defaults.DefaultSnapshotter)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
"testing"
|
||||
|
||||
. "github.com/containerd/containerd/v2/client"
|
||||
"github.com/containerd/containerd/v2/defaults"
|
||||
"github.com/containerd/containerd/v2/snapshots"
|
||||
"github.com/containerd/containerd/v2/snapshots/testsuite"
|
||||
)
|
||||
@@ -31,7 +32,7 @@ func newSnapshotter(ctx context.Context, root string) (snapshots.Snapshotter, fu
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
sn := client.SnapshotService(DefaultSnapshotter)
|
||||
sn := client.SnapshotService(defaults.DefaultSnapshotter)
|
||||
|
||||
return sn, func() error {
|
||||
// no need to close remote snapshotter
|
||||
@@ -44,5 +45,5 @@ func TestSnapshotterClient(t *testing.T) {
|
||||
t.Skip()
|
||||
}
|
||||
|
||||
testsuite.SnapshotterSuite(t, DefaultSnapshotter, newSnapshotter)
|
||||
testsuite.SnapshotterSuite(t, defaults.DefaultSnapshotter, newSnapshotter)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user