From d9b9160ae1d21de97a1aa9464440c3a50b478a90 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Mon, 4 Mar 2024 16:59:49 +0900 Subject: [PATCH] mv internal/testutil pkg/testutil The package is consumed by several snapshotter plugins Signed-off-by: Akihiro Suda --- core/content/testsuite/testsuite.go | 2 +- core/metadata/snapshot_test.go | 2 +- core/runtime/v2/bundle_linux_test.go | 2 +- core/runtime/v2/bundle_test.go | 2 +- core/snapshots/storage/bolt_test.go | 2 +- core/snapshots/testsuite/testsuite.go | 2 +- integration/client/client_test.go | 2 +- integration/client/restart_monitor_test.go | 2 +- pkg/archive/issues_test.go | 2 +- pkg/archive/tar_linux_test.go | 2 +- pkg/archive/tar_test.go | 2 +- pkg/oci/spec_opts_linux_test.go | 2 +- pkg/oci/spec_test.go | 2 +- {internal => pkg}/testutil/helpers.go | 0 {internal => pkg}/testutil/helpers_unix.go | 0 {internal => pkg}/testutil/helpers_windows.go | 0 plugins/content/local/store_test.go | 2 +- plugins/snapshots/blockfile/blockfile_test.go | 2 +- plugins/snapshots/btrfs/btrfs_test.go | 2 +- plugins/snapshots/devmapper/dmsetup/dmsetup_test.go | 2 +- plugins/snapshots/devmapper/pool_device_test.go | 2 +- plugins/snapshots/devmapper/snapshotter_test.go | 2 +- plugins/snapshots/native/native_test.go | 2 +- plugins/snapshots/overlay/overlay_test.go | 2 +- plugins/snapshots/overlay/overlayutils/check_test.go | 2 +- plugins/snapshots/windows/windows_test.go | 2 +- 26 files changed, 23 insertions(+), 23 deletions(-) rename {internal => pkg}/testutil/helpers.go (100%) rename {internal => pkg}/testutil/helpers_unix.go (100%) rename {internal => pkg}/testutil/helpers_windows.go (100%) diff --git a/core/content/testsuite/testsuite.go b/core/content/testsuite/testsuite.go index 1dd2d816e..3221a355d 100644 --- a/core/content/testsuite/testsuite.go +++ b/core/content/testsuite/testsuite.go @@ -29,7 +29,7 @@ import ( "time" "github.com/containerd/containerd/v2/core/content" - "github.com/containerd/containerd/v2/internal/testutil" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/errdefs" "github.com/containerd/log/logtest" "github.com/opencontainers/go-digest" diff --git a/core/metadata/snapshot_test.go b/core/metadata/snapshot_test.go index 0f9028c83..9db4c90b6 100644 --- a/core/metadata/snapshot_test.go +++ b/core/metadata/snapshot_test.go @@ -30,9 +30,9 @@ import ( "github.com/containerd/containerd/v2/core/mount" "github.com/containerd/containerd/v2/core/snapshots" "github.com/containerd/containerd/v2/core/snapshots/testsuite" - "github.com/containerd/containerd/v2/internal/testutil" "github.com/containerd/containerd/v2/pkg/filters" "github.com/containerd/containerd/v2/pkg/namespaces" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/containerd/v2/plugins/snapshots/native" "github.com/containerd/errdefs" bolt "go.etcd.io/bbolt" diff --git a/core/runtime/v2/bundle_linux_test.go b/core/runtime/v2/bundle_linux_test.go index 377db1c5e..c65cdbf91 100644 --- a/core/runtime/v2/bundle_linux_test.go +++ b/core/runtime/v2/bundle_linux_test.go @@ -26,9 +26,9 @@ import ( "syscall" "testing" - "github.com/containerd/containerd/v2/internal/testutil" "github.com/containerd/containerd/v2/pkg/namespaces" "github.com/containerd/containerd/v2/pkg/oci" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/typeurl/v2" "github.com/opencontainers/runtime-spec/specs-go" "github.com/stretchr/testify/assert" diff --git a/core/runtime/v2/bundle_test.go b/core/runtime/v2/bundle_test.go index 096df28a7..ea5d15462 100644 --- a/core/runtime/v2/bundle_test.go +++ b/core/runtime/v2/bundle_test.go @@ -19,5 +19,5 @@ package v2 import ( // When testutil is imported for one platform (bundle_linux_test.go) it // should be imported for all platforms. - _ "github.com/containerd/containerd/v2/internal/testutil" + _ "github.com/containerd/containerd/v2/pkg/testutil" ) diff --git a/core/snapshots/storage/bolt_test.go b/core/snapshots/storage/bolt_test.go index 4fe26b075..afef0f14a 100644 --- a/core/snapshots/storage/bolt_test.go +++ b/core/snapshots/storage/bolt_test.go @@ -22,7 +22,7 @@ import ( // Does not require root but flag must be defined for snapshot tests - _ "github.com/containerd/containerd/v2/internal/testutil" + _ "github.com/containerd/containerd/v2/pkg/testutil" ) func TestMetastore(t *testing.T) { diff --git a/core/snapshots/testsuite/testsuite.go b/core/snapshots/testsuite/testsuite.go index a3d269fd1..06e15d27d 100644 --- a/core/snapshots/testsuite/testsuite.go +++ b/core/snapshots/testsuite/testsuite.go @@ -31,8 +31,8 @@ import ( "github.com/containerd/containerd/v2/core/mount" "github.com/containerd/containerd/v2/core/snapshots" "github.com/containerd/containerd/v2/internal/randutil" - "github.com/containerd/containerd/v2/internal/testutil" "github.com/containerd/containerd/v2/pkg/namespaces" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/continuity/fs/fstest" "github.com/containerd/errdefs" "github.com/containerd/log/logtest" diff --git a/integration/client/client_test.go b/integration/client/client_test.go index 7e0fb208c..2f7fbcce8 100644 --- a/integration/client/client_test.go +++ b/integration/client/client_test.go @@ -39,9 +39,9 @@ import ( "github.com/containerd/containerd/v2/core/leases" "github.com/containerd/containerd/v2/defaults" imagelist "github.com/containerd/containerd/v2/integration/images" - "github.com/containerd/containerd/v2/internal/testutil" "github.com/containerd/containerd/v2/pkg/deprecation" "github.com/containerd/containerd/v2/pkg/namespaces" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/errdefs" "github.com/containerd/log" "github.com/containerd/platforms" diff --git a/integration/client/restart_monitor_test.go b/integration/client/restart_monitor_test.go index b9dcae438..81d9ade02 100644 --- a/integration/client/restart_monitor_test.go +++ b/integration/client/restart_monitor_test.go @@ -35,8 +35,8 @@ import ( . "github.com/containerd/containerd/v2/client" srvconfig "github.com/containerd/containerd/v2/cmd/containerd/server/config" "github.com/containerd/containerd/v2/core/runtime/restart" - "github.com/containerd/containerd/v2/internal/testutil" "github.com/containerd/containerd/v2/pkg/oci" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/typeurl/v2" "github.com/stretchr/testify/require" ) diff --git a/pkg/archive/issues_test.go b/pkg/archive/issues_test.go index c526a3c3b..e2a469ba6 100644 --- a/pkg/archive/issues_test.go +++ b/pkg/archive/issues_test.go @@ -24,8 +24,8 @@ import ( "strings" "testing" - "github.com/containerd/containerd/v2/internal/testutil" "github.com/containerd/containerd/v2/pkg/archive/compression" + "github.com/containerd/containerd/v2/pkg/testutil" ) // TestPrefixHeaderReadable tests that files that could be created with the diff --git a/pkg/archive/tar_linux_test.go b/pkg/archive/tar_linux_test.go index 495e19bee..c5e0b5af7 100644 --- a/pkg/archive/tar_linux_test.go +++ b/pkg/archive/tar_linux_test.go @@ -26,7 +26,7 @@ import ( "testing" "github.com/containerd/containerd/v2/core/mount" - "github.com/containerd/containerd/v2/internal/testutil" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/containerd/v2/plugins/snapshots/overlay/overlayutils" "github.com/containerd/continuity/fs" "github.com/containerd/continuity/fs/fstest" diff --git a/pkg/archive/tar_test.go b/pkg/archive/tar_test.go index 3e677d03e..5f322675b 100644 --- a/pkg/archive/tar_test.go +++ b/pkg/archive/tar_test.go @@ -33,8 +33,8 @@ import ( "testing" "time" - "github.com/containerd/containerd/v2/internal/testutil" "github.com/containerd/containerd/v2/pkg/archive/tartest" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/continuity/fs" "github.com/containerd/continuity/fs/fstest" "github.com/opencontainers/go-digest" diff --git a/pkg/oci/spec_opts_linux_test.go b/pkg/oci/spec_opts_linux_test.go index d6890e785..9299fa180 100644 --- a/pkg/oci/spec_opts_linux_test.go +++ b/pkg/oci/spec_opts_linux_test.go @@ -24,8 +24,8 @@ import ( "testing" "github.com/containerd/containerd/v2/core/containers" - "github.com/containerd/containerd/v2/internal/testutil" "github.com/containerd/containerd/v2/pkg/cap" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/continuity/fs/fstest" specs "github.com/opencontainers/runtime-spec/specs-go" "github.com/stretchr/testify/assert" diff --git a/pkg/oci/spec_test.go b/pkg/oci/spec_test.go index 418cafdff..5e0a48986 100644 --- a/pkg/oci/spec_test.go +++ b/pkg/oci/spec_test.go @@ -24,8 +24,8 @@ import ( "github.com/opencontainers/runtime-spec/specs-go" "github.com/containerd/containerd/v2/core/containers" - "github.com/containerd/containerd/v2/internal/testutil" "github.com/containerd/containerd/v2/pkg/namespaces" + "github.com/containerd/containerd/v2/pkg/testutil" ) func TestGenerateSpec(t *testing.T) { diff --git a/internal/testutil/helpers.go b/pkg/testutil/helpers.go similarity index 100% rename from internal/testutil/helpers.go rename to pkg/testutil/helpers.go diff --git a/internal/testutil/helpers_unix.go b/pkg/testutil/helpers_unix.go similarity index 100% rename from internal/testutil/helpers_unix.go rename to pkg/testutil/helpers_unix.go diff --git a/internal/testutil/helpers_windows.go b/pkg/testutil/helpers_windows.go similarity index 100% rename from internal/testutil/helpers_windows.go rename to pkg/testutil/helpers_windows.go diff --git a/plugins/content/local/store_test.go b/plugins/content/local/store_test.go index 6253a4e1f..03e1bbff9 100644 --- a/plugins/content/local/store_test.go +++ b/plugins/content/local/store_test.go @@ -35,7 +35,7 @@ import ( "github.com/containerd/containerd/v2/core/content" "github.com/containerd/containerd/v2/core/content/testsuite" "github.com/containerd/containerd/v2/internal/randutil" - "github.com/containerd/containerd/v2/internal/testutil" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/errdefs" "github.com/opencontainers/go-digest" diff --git a/plugins/snapshots/blockfile/blockfile_test.go b/plugins/snapshots/blockfile/blockfile_test.go index 2adfd1639..4fcf5c252 100644 --- a/plugins/snapshots/blockfile/blockfile_test.go +++ b/plugins/snapshots/blockfile/blockfile_test.go @@ -22,7 +22,7 @@ import ( "github.com/containerd/containerd/v2/core/snapshots" "github.com/containerd/containerd/v2/core/snapshots/testsuite" - "github.com/containerd/containerd/v2/internal/testutil" + "github.com/containerd/containerd/v2/pkg/testutil" ) func newSnapshotter(t *testing.T) func(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error) { diff --git a/plugins/snapshots/btrfs/btrfs_test.go b/plugins/snapshots/btrfs/btrfs_test.go index 51c8d8f15..8c80530fc 100644 --- a/plugins/snapshots/btrfs/btrfs_test.go +++ b/plugins/snapshots/btrfs/btrfs_test.go @@ -33,7 +33,7 @@ import ( "github.com/containerd/containerd/v2/core/mount" "github.com/containerd/containerd/v2/core/snapshots" "github.com/containerd/containerd/v2/core/snapshots/testsuite" - "github.com/containerd/containerd/v2/internal/testutil" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/continuity/testutil/loopback" "github.com/containerd/plugin" "golang.org/x/sys/unix" diff --git a/plugins/snapshots/devmapper/dmsetup/dmsetup_test.go b/plugins/snapshots/devmapper/dmsetup/dmsetup_test.go index 8c68a0744..701147278 100644 --- a/plugins/snapshots/devmapper/dmsetup/dmsetup_test.go +++ b/plugins/snapshots/devmapper/dmsetup/dmsetup_test.go @@ -24,7 +24,7 @@ import ( "testing" "github.com/containerd/containerd/v2/core/mount" - "github.com/containerd/containerd/v2/internal/testutil" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/docker/go-units" "github.com/stretchr/testify/assert" "golang.org/x/sys/unix" diff --git a/plugins/snapshots/devmapper/pool_device_test.go b/plugins/snapshots/devmapper/pool_device_test.go index 9649b00cf..3c368a7e8 100644 --- a/plugins/snapshots/devmapper/pool_device_test.go +++ b/plugins/snapshots/devmapper/pool_device_test.go @@ -28,7 +28,7 @@ import ( "time" "github.com/containerd/containerd/v2/core/mount" - "github.com/containerd/containerd/v2/internal/testutil" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/containerd/v2/plugins/snapshots/devmapper/dmsetup" "github.com/containerd/log" "github.com/docker/go-units" diff --git a/plugins/snapshots/devmapper/snapshotter_test.go b/plugins/snapshots/devmapper/snapshotter_test.go index fc5aec16c..fba424df2 100644 --- a/plugins/snapshots/devmapper/snapshotter_test.go +++ b/plugins/snapshots/devmapper/snapshotter_test.go @@ -32,8 +32,8 @@ import ( "github.com/containerd/containerd/v2/core/mount" "github.com/containerd/containerd/v2/core/snapshots" "github.com/containerd/containerd/v2/core/snapshots/testsuite" - "github.com/containerd/containerd/v2/internal/testutil" "github.com/containerd/containerd/v2/pkg/namespaces" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/containerd/v2/plugins/snapshots/devmapper/dmsetup" "github.com/containerd/log" ) diff --git a/plugins/snapshots/native/native_test.go b/plugins/snapshots/native/native_test.go index 6be5a5ba2..1055cdbc9 100644 --- a/plugins/snapshots/native/native_test.go +++ b/plugins/snapshots/native/native_test.go @@ -23,7 +23,7 @@ import ( "github.com/containerd/containerd/v2/core/snapshots" "github.com/containerd/containerd/v2/core/snapshots/testsuite" - "github.com/containerd/containerd/v2/internal/testutil" + "github.com/containerd/containerd/v2/pkg/testutil" ) func newSnapshotter(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error) { diff --git a/plugins/snapshots/overlay/overlay_test.go b/plugins/snapshots/overlay/overlay_test.go index 562dfbd94..5cb6bc30a 100644 --- a/plugins/snapshots/overlay/overlay_test.go +++ b/plugins/snapshots/overlay/overlay_test.go @@ -31,7 +31,7 @@ import ( "github.com/containerd/containerd/v2/core/snapshots" "github.com/containerd/containerd/v2/core/snapshots/storage" "github.com/containerd/containerd/v2/core/snapshots/testsuite" - "github.com/containerd/containerd/v2/internal/testutil" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/containerd/v2/plugins/snapshots/overlay/overlayutils" "github.com/opencontainers/runtime-spec/specs-go" ) diff --git a/plugins/snapshots/overlay/overlayutils/check_test.go b/plugins/snapshots/overlay/overlayutils/check_test.go index db9bb463c..bb51376a3 100644 --- a/plugins/snapshots/overlay/overlayutils/check_test.go +++ b/plugins/snapshots/overlay/overlayutils/check_test.go @@ -22,7 +22,7 @@ import ( "os/exec" "testing" - "github.com/containerd/containerd/v2/internal/testutil" + "github.com/containerd/containerd/v2/pkg/testutil" "github.com/containerd/continuity/testutil/loopback" ) diff --git a/plugins/snapshots/windows/windows_test.go b/plugins/snapshots/windows/windows_test.go index 8a2f10117..457a72296 100644 --- a/plugins/snapshots/windows/windows_test.go +++ b/plugins/snapshots/windows/windows_test.go @@ -25,7 +25,7 @@ import ( "github.com/containerd/containerd/v2/core/snapshots" "github.com/containerd/containerd/v2/core/snapshots/testsuite" - "github.com/containerd/containerd/v2/internal/testutil" + "github.com/containerd/containerd/v2/pkg/testutil" ) func newSnapshotter(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error) {