diff --git a/integration-cli/check_test.go b/integration-cli/check_test.go index 919e41e723..ce601e2352 100644 --- a/integration-cli/check_test.go +++ b/integration-cli/check_test.go @@ -19,13 +19,13 @@ import ( "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/daemon" "github.com/docker/docker/integration-cli/environment" - testdaemon "github.com/docker/docker/internal/test/daemon" - ienv "github.com/docker/docker/internal/test/environment" - "github.com/docker/docker/internal/test/fakestorage" - "github.com/docker/docker/internal/test/fixtures/plugin" - "github.com/docker/docker/internal/test/registry" "github.com/docker/docker/internal/test/suite" "github.com/docker/docker/pkg/reexec" + testdaemon "github.com/docker/docker/testutil/daemon" + ienv "github.com/docker/docker/testutil/environment" + "github.com/docker/docker/testutil/fakestorage" + "github.com/docker/docker/testutil/fixtures/plugin" + "github.com/docker/docker/testutil/registry" "gotest.tools/assert" ) diff --git a/integration-cli/cli/build/build.go b/integration-cli/cli/build/build.go index 0b10ea79f8..510cd927cd 100644 --- a/integration-cli/cli/build/build.go +++ b/integration-cli/cli/build/build.go @@ -4,7 +4,7 @@ import ( "io" "strings" - "github.com/docker/docker/internal/test/fakecontext" + "github.com/docker/docker/testutil/fakecontext" "gotest.tools/icmd" ) diff --git a/integration-cli/daemon/daemon.go b/integration-cli/daemon/daemon.go index f8ba48c383..d138f85ce5 100644 --- a/integration-cli/daemon/daemon.go +++ b/integration-cli/daemon/daemon.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/docker/docker/internal/test/daemon" + "github.com/docker/docker/testutil/daemon" "github.com/pkg/errors" "gotest.tools/assert" "gotest.tools/icmd" diff --git a/integration-cli/docker_api_attach_test.go b/integration-cli/docker_api_attach_test.go index 530823e0d3..59b550aa7a 100644 --- a/integration-cli/docker_api_attach_test.go +++ b/integration-cli/docker_api_attach_test.go @@ -15,8 +15,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/client" - "github.com/docker/docker/internal/test/request" "github.com/docker/docker/pkg/stdcopy" + "github.com/docker/docker/testutil/request" "github.com/pkg/errors" "golang.org/x/net/websocket" "gotest.tools/assert" diff --git a/integration-cli/docker_api_build_test.go b/integration-cli/docker_api_build_test.go index be96cb9df0..f1acaed9d7 100644 --- a/integration-cli/docker_api_build_test.go +++ b/integration-cli/docker_api_build_test.go @@ -14,10 +14,10 @@ import ( "testing" "github.com/docker/docker/api/types" - "github.com/docker/docker/internal/test/fakecontext" - "github.com/docker/docker/internal/test/fakegit" - "github.com/docker/docker/internal/test/fakestorage" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/fakecontext" + "github.com/docker/docker/testutil/fakegit" + "github.com/docker/docker/testutil/fakestorage" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" ) diff --git a/integration-cli/docker_api_build_windows_test.go b/integration-cli/docker_api_build_windows_test.go index f19cc7a4e1..682de714ac 100644 --- a/integration-cli/docker_api_build_windows_test.go +++ b/integration-cli/docker_api_build_windows_test.go @@ -6,8 +6,8 @@ import ( "net/http" "testing" - "github.com/docker/docker/internal/test/fakecontext" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/fakecontext" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" ) diff --git a/integration-cli/docker_api_containers_test.go b/integration-cli/docker_api_containers_test.go index 13f1a55ba3..db5c064153 100644 --- a/integration-cli/docker_api_containers_test.go +++ b/integration-cli/docker_api_containers_test.go @@ -25,10 +25,10 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli/build" - "github.com/docker/docker/internal/test/request" "github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/mount" "github.com/docker/docker/pkg/stringid" + "github.com/docker/docker/testutil/request" "github.com/docker/docker/volume" "github.com/docker/go-connections/nat" "gotest.tools/assert" diff --git a/integration-cli/docker_api_exec_resize_test.go b/integration-cli/docker_api_exec_resize_test.go index 0781fbbb15..146552bfbe 100644 --- a/integration-cli/docker_api_exec_resize_test.go +++ b/integration-cli/docker_api_exec_resize_test.go @@ -11,7 +11,7 @@ import ( "testing" "github.com/docker/docker/api/types/versions" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" ) diff --git a/integration-cli/docker_api_exec_test.go b/integration-cli/docker_api_exec_test.go index b8c257f80b..6684243fd4 100644 --- a/integration-cli/docker_api_exec_test.go +++ b/integration-cli/docker_api_exec_test.go @@ -16,7 +16,7 @@ import ( "github.com/docker/docker/api/types/versions" "github.com/docker/docker/client" "github.com/docker/docker/integration-cli/checker" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" "gotest.tools/poll" ) diff --git a/integration-cli/docker_api_images_test.go b/integration-cli/docker_api_images_test.go index 8f561c1d28..733c5c29be 100644 --- a/integration-cli/docker_api_images_test.go +++ b/integration-cli/docker_api_images_test.go @@ -14,8 +14,8 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli/build" - "github.com/docker/docker/internal/test/request" "github.com/docker/docker/pkg/parsers/kernel" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" ) diff --git a/integration-cli/docker_api_logs_test.go b/integration-cli/docker_api_logs_test.go index 8a0d540f97..848df4b7f4 100644 --- a/integration-cli/docker_api_logs_test.go +++ b/integration-cli/docker_api_logs_test.go @@ -15,8 +15,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/client" - "github.com/docker/docker/internal/test/request" "github.com/docker/docker/pkg/stdcopy" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" ) diff --git a/integration-cli/docker_api_network_test.go b/integration-cli/docker_api_network_test.go index baa43d06b6..4c4be109f9 100644 --- a/integration-cli/docker_api_network_test.go +++ b/integration-cli/docker_api_network_test.go @@ -13,7 +13,7 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/versions" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" ) diff --git a/integration-cli/docker_api_stats_test.go b/integration-cli/docker_api_stats_test.go index 3c04bdb3ff..e1e34d39c6 100644 --- a/integration-cli/docker_api_stats_test.go +++ b/integration-cli/docker_api_stats_test.go @@ -16,7 +16,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/versions" "github.com/docker/docker/client" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" ) diff --git a/integration-cli/docker_api_swarm_service_test.go b/integration-cli/docker_api_swarm_service_test.go index e0500e6242..ebf12fb8b6 100644 --- a/integration-cli/docker_api_swarm_service_test.go +++ b/integration-cli/docker_api_swarm_service_test.go @@ -16,7 +16,7 @@ import ( "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli/build" "github.com/docker/docker/integration-cli/daemon" - testdaemon "github.com/docker/docker/internal/test/daemon" + testdaemon "github.com/docker/docker/testutil/daemon" "golang.org/x/sys/unix" "gotest.tools/assert" "gotest.tools/icmd" diff --git a/integration-cli/docker_api_swarm_test.go b/integration-cli/docker_api_swarm_test.go index 8e230fa53a..4b3b418f0e 100644 --- a/integration-cli/docker_api_swarm_test.go +++ b/integration-cli/docker_api_swarm_test.go @@ -24,8 +24,8 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/integration-cli/daemon" - testdaemon "github.com/docker/docker/internal/test/daemon" - "github.com/docker/docker/internal/test/request" + testdaemon "github.com/docker/docker/testutil/daemon" + "github.com/docker/docker/testutil/request" "github.com/docker/swarmkit/ca" "github.com/pkg/errors" "gotest.tools/assert" diff --git a/integration-cli/docker_api_test.go b/integration-cli/docker_api_test.go index 9ada07e615..a0ed64d5bc 100644 --- a/integration-cli/docker_api_test.go +++ b/integration-cli/docker_api_test.go @@ -11,7 +11,7 @@ import ( "github.com/docker/docker/api" "github.com/docker/docker/api/types/versions" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" ) diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index 4ccb1b8961..ebe42f3e8d 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/integration-cli/docker_cli_build_test.go @@ -19,12 +19,12 @@ import ( "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli/build" - "github.com/docker/docker/internal/test/fakecontext" - "github.com/docker/docker/internal/test/fakegit" - "github.com/docker/docker/internal/test/fakestorage" - "github.com/docker/docker/internal/testutil" "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/system" + "github.com/docker/docker/testutil" + "github.com/docker/docker/testutil/fakecontext" + "github.com/docker/docker/testutil/fakegit" + "github.com/docker/docker/testutil/fakestorage" "github.com/moby/buildkit/frontend/dockerfile/command" "github.com/opencontainers/go-digest" "gotest.tools/assert" diff --git a/integration-cli/docker_cli_build_unix_test.go b/integration-cli/docker_cli_build_unix_test.go index ef6da0e623..2d56e2ac94 100644 --- a/integration-cli/docker_cli_build_unix_test.go +++ b/integration-cli/docker_cli_build_unix_test.go @@ -18,7 +18,7 @@ import ( "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli/build" - "github.com/docker/docker/internal/test/fakecontext" + "github.com/docker/docker/testutil/fakecontext" "github.com/docker/go-units" "gotest.tools/assert" "gotest.tools/icmd" diff --git a/integration-cli/docker_cli_create_test.go b/integration-cli/docker_cli_create_test.go index 36764eb36b..078bc697f8 100644 --- a/integration-cli/docker_cli_create_test.go +++ b/integration-cli/docker_cli_create_test.go @@ -11,8 +11,8 @@ import ( "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli/build" - "github.com/docker/docker/internal/test/fakecontext" "github.com/docker/docker/pkg/stringid" + "github.com/docker/docker/testutil/fakecontext" "github.com/docker/go-connections/nat" "gotest.tools/assert" is "gotest.tools/assert/cmp" diff --git a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go index 8e3f6b3499..48c0a676b3 100644 --- a/integration-cli/docker_cli_daemon_test.go +++ b/integration-cli/docker_cli_daemon_test.go @@ -31,9 +31,9 @@ import ( "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli/build" "github.com/docker/docker/integration-cli/daemon" - testdaemon "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/opts" "github.com/docker/docker/pkg/mount" + testdaemon "github.com/docker/docker/testutil/daemon" "github.com/docker/go-units" "github.com/docker/libnetwork/iptables" "github.com/docker/libtrust" diff --git a/integration-cli/docker_cli_external_volume_driver_test.go b/integration-cli/docker_cli_external_volume_driver_test.go index e2ce30155b..83ae43aa77 100644 --- a/integration-cli/docker_cli_external_volume_driver_test.go +++ b/integration-cli/docker_cli_external_volume_driver_test.go @@ -16,8 +16,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/integration-cli/daemon" - testdaemon "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/pkg/stringid" + testdaemon "github.com/docker/docker/testutil/daemon" "github.com/docker/docker/volume" "gotest.tools/assert" ) diff --git a/integration-cli/docker_cli_info_test.go b/integration-cli/docker_cli_info_test.go index 173eec22f6..a040bde3ce 100644 --- a/integration-cli/docker_cli_info_test.go +++ b/integration-cli/docker_cli_info_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/docker/docker/integration-cli/daemon" - testdaemon "github.com/docker/docker/internal/test/daemon" + testdaemon "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" ) diff --git a/integration-cli/docker_cli_network_unix_test.go b/integration-cli/docker_cli_network_unix_test.go index a47c78960a..8d3edec812 100644 --- a/integration-cli/docker_cli_network_unix_test.go +++ b/integration-cli/docker_cli_network_unix_test.go @@ -18,9 +18,9 @@ import ( "github.com/docker/docker/api/types/versions/v1p20" "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/daemon" - testdaemon "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/pkg/stringid" "github.com/docker/docker/runconfig" + testdaemon "github.com/docker/docker/testutil/daemon" "github.com/docker/libnetwork/driverapi" remoteapi "github.com/docker/libnetwork/drivers/remote/api" "github.com/docker/libnetwork/ipamapi" diff --git a/integration-cli/docker_cli_plugins_test.go b/integration-cli/docker_cli_plugins_test.go index 576c39a863..2dbaae1d71 100644 --- a/integration-cli/docker_cli_plugins_test.go +++ b/integration-cli/docker_cli_plugins_test.go @@ -15,7 +15,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/daemon" - "github.com/docker/docker/internal/test/fixtures/plugin" + "github.com/docker/docker/testutil/fixtures/plugin" "gotest.tools/assert" ) diff --git a/integration-cli/docker_cli_registry_user_agent_test.go b/integration-cli/docker_cli_registry_user_agent_test.go index c03fcb0be9..257a47fb47 100644 --- a/integration-cli/docker_cli_registry_user_agent_test.go +++ b/integration-cli/docker_cli_registry_user_agent_test.go @@ -8,7 +8,7 @@ import ( "regexp" "testing" - "github.com/docker/docker/internal/test/registry" + "github.com/docker/docker/testutil/registry" "gotest.tools/assert" ) diff --git a/integration-cli/docker_cli_run_test.go b/integration-cli/docker_cli_run_test.go index 34e1f9da1d..df21866207 100644 --- a/integration-cli/docker_cli_run_test.go +++ b/integration-cli/docker_cli_run_test.go @@ -26,12 +26,12 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli/build" - "github.com/docker/docker/internal/test/fakecontext" - "github.com/docker/docker/internal/testutil" "github.com/docker/docker/pkg/mount" "github.com/docker/docker/pkg/parsers/kernel" "github.com/docker/docker/pkg/stringid" "github.com/docker/docker/runconfig" + "github.com/docker/docker/testutil" + "github.com/docker/docker/testutil/fakecontext" "github.com/docker/go-connections/nat" "github.com/docker/libnetwork/resolvconf" "github.com/docker/libnetwork/types" diff --git a/integration-cli/docker_cli_update_unix_test.go b/integration-cli/docker_cli_update_unix_test.go index a02e154b66..ad5a7ab145 100644 --- a/integration-cli/docker_cli_update_unix_test.go +++ b/integration-cli/docker_cli_update_unix_test.go @@ -14,8 +14,8 @@ import ( "github.com/creack/pty" "github.com/docker/docker/api/types" "github.com/docker/docker/client" - "github.com/docker/docker/internal/test/request" "github.com/docker/docker/pkg/parsers/kernel" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" ) diff --git a/integration-cli/docker_cli_v2_only_test.go b/integration-cli/docker_cli_v2_only_test.go index 299ea5079d..f985a360f9 100644 --- a/integration-cli/docker_cli_v2_only_test.go +++ b/integration-cli/docker_cli_v2_only_test.go @@ -7,7 +7,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/registry" + "github.com/docker/docker/testutil/registry" "gotest.tools/assert" ) diff --git a/integration-cli/docker_deprecated_api_v124_test.go b/integration-cli/docker_deprecated_api_v124_test.go index b11e3644fa..f448b8a02a 100644 --- a/integration-cli/docker_deprecated_api_v124_test.go +++ b/integration-cli/docker_deprecated_api_v124_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/docker/docker/api/types/versions" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" ) diff --git a/integration-cli/docker_deprecated_api_v124_unix_test.go b/integration-cli/docker_deprecated_api_v124_unix_test.go index 06959ebf08..7e0c0e50ec 100644 --- a/integration-cli/docker_deprecated_api_v124_unix_test.go +++ b/integration-cli/docker_deprecated_api_v124_unix_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" ) diff --git a/integration-cli/docker_hub_pull_suite_test.go b/integration-cli/docker_hub_pull_suite_test.go index 3da77e8339..e9808c6dbf 100644 --- a/integration-cli/docker_hub_pull_suite_test.go +++ b/integration-cli/docker_hub_pull_suite_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/docker/docker/integration-cli/daemon" - testdaemon "github.com/docker/docker/internal/test/daemon" + testdaemon "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" ) diff --git a/integration-cli/environment/environment.go b/integration-cli/environment/environment.go index 82cf99652b..0dcf8d9294 100644 --- a/integration-cli/environment/environment.go +++ b/integration-cli/environment/environment.go @@ -4,7 +4,7 @@ import ( "os" "os/exec" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var ( diff --git a/integration-cli/fixtures_linux_daemon_test.go b/integration-cli/fixtures_linux_daemon_test.go index de401b9dbc..2f38f3bae7 100644 --- a/integration-cli/fixtures_linux_daemon_test.go +++ b/integration-cli/fixtures_linux_daemon_test.go @@ -10,7 +10,7 @@ import ( "strings" "testing" - "github.com/docker/docker/internal/test/fixtures/load" + "github.com/docker/docker/testutil/fixtures/load" "gotest.tools/assert" ) diff --git a/integration-cli/requirements_test.go b/integration-cli/requirements_test.go index 658b5581c6..9e4971451f 100644 --- a/integration-cli/requirements_test.go +++ b/integration-cli/requirements_test.go @@ -16,7 +16,7 @@ import ( "github.com/docker/docker/api/types/versions" "github.com/docker/docker/client" "github.com/docker/docker/integration-cli/requirement" - "github.com/docker/docker/internal/test/registry" + "github.com/docker/docker/testutil/registry" ) func ArchitectureIsNot(arch string) bool { diff --git a/integration-cli/utils_test.go b/integration-cli/utils_test.go index 9746f6c873..145857fcf6 100644 --- a/integration-cli/utils_test.go +++ b/integration-cli/utils_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/docker/docker/internal/testutil" + "github.com/docker/docker/testutil" "github.com/pkg/errors" "gotest.tools/icmd" ) diff --git a/integration/build/build_cgroupns_linux_test.go b/integration/build/build_cgroupns_linux_test.go index 258a1ec979..e88cdc5bb8 100644 --- a/integration/build/build_cgroupns_linux_test.go +++ b/integration/build/build_cgroupns_linux_test.go @@ -9,9 +9,9 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/integration/internal/requirement" - "github.com/docker/docker/internal/test/daemon" - "github.com/docker/docker/internal/test/fakecontext" "github.com/docker/docker/pkg/jsonmessage" + "github.com/docker/docker/testutil/daemon" + "github.com/docker/docker/testutil/fakecontext" "gotest.tools/assert" "gotest.tools/skip" ) diff --git a/integration/build/build_session_test.go b/integration/build/build_session_test.go index 578ea2102c..ed89bae2bc 100644 --- a/integration/build/build_session_test.go +++ b/integration/build/build_session_test.go @@ -11,8 +11,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/versions" dclient "github.com/docker/docker/client" - "github.com/docker/docker/internal/test/fakecontext" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/fakecontext" + "github.com/docker/docker/testutil/request" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/filesync" "golang.org/x/sync/errgroup" diff --git a/integration/build/build_squash_test.go b/integration/build/build_squash_test.go index 4398ebc7b7..df59b25657 100644 --- a/integration/build/build_squash_test.go +++ b/integration/build/build_squash_test.go @@ -11,9 +11,9 @@ import ( "github.com/docker/docker/api/types" dclient "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/daemon" - "github.com/docker/docker/internal/test/fakecontext" "github.com/docker/docker/pkg/stdcopy" + "github.com/docker/docker/testutil/daemon" + "github.com/docker/docker/testutil/fakecontext" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/skip" diff --git a/integration/build/build_test.go b/integration/build/build_test.go index 26c1380892..a1f4e37193 100644 --- a/integration/build/build_test.go +++ b/integration/build/build_test.go @@ -14,8 +14,8 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/versions" "github.com/docker/docker/errdefs" - "github.com/docker/docker/internal/test/fakecontext" "github.com/docker/docker/pkg/jsonmessage" + "github.com/docker/docker/testutil/fakecontext" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/skip" diff --git a/integration/build/main_test.go b/integration/build/main_test.go index fef3909fd5..735f2a49a6 100644 --- a/integration/build/main_test.go +++ b/integration/build/main_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var testEnv *environment.Execution diff --git a/integration/config/config_test.go b/integration/config/config_test.go index ec5b060cd2..a189fe7f84 100644 --- a/integration/config/config_test.go +++ b/integration/config/config_test.go @@ -15,8 +15,8 @@ import ( swarmtypes "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/swarm" - "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/pkg/stdcopy" + "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/poll" diff --git a/integration/config/main_test.go b/integration/config/main_test.go index 3c8f0483f2..dc5c8e834d 100644 --- a/integration/config/main_test.go +++ b/integration/config/main_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var testEnv *environment.Execution diff --git a/integration/container/checkpoint_test.go b/integration/container/checkpoint_test.go index 7f7c74e8cc..726fe672c6 100644 --- a/integration/container/checkpoint_test.go +++ b/integration/container/checkpoint_test.go @@ -13,7 +13,7 @@ import ( mounttypes "github.com/docker/docker/api/types/mount" "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/poll" diff --git a/integration/container/container_test.go b/integration/container/container_test.go index a4ae31e948..7365d142e2 100644 --- a/integration/container/container_test.go +++ b/integration/container/container_test.go @@ -4,7 +4,7 @@ import ( "net/http" "testing" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" ) diff --git a/integration/container/copy_test.go b/integration/container/copy_test.go index 0b6123a80b..229fe0a908 100644 --- a/integration/container/copy_test.go +++ b/integration/container/copy_test.go @@ -13,8 +13,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/fakecontext" "github.com/docker/docker/pkg/jsonmessage" + "github.com/docker/docker/testutil/fakecontext" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/skip" diff --git a/integration/container/create_test.go b/integration/container/create_test.go index b4bd23bce8..7be1cb6eac 100644 --- a/integration/container/create_test.go +++ b/integration/container/create_test.go @@ -15,8 +15,8 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/errdefs" ctr "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/request" "github.com/docker/docker/oci" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/poll" diff --git a/integration/container/daemon_linux_test.go b/integration/container/daemon_linux_test.go index 32788375a2..39f056fabe 100644 --- a/integration/container/daemon_linux_test.go +++ b/integration/container/daemon_linux_test.go @@ -10,7 +10,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/daemon" + "github.com/docker/docker/testutil/daemon" "golang.org/x/sys/unix" "gotest.tools/assert" is "gotest.tools/assert/cmp" diff --git a/integration/container/export_test.go b/integration/container/export_test.go index 98b52456a8..9058eda8a1 100644 --- a/integration/container/export_test.go +++ b/integration/container/export_test.go @@ -9,8 +9,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/pkg/jsonmessage" + "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/poll" diff --git a/integration/container/inspect_test.go b/integration/container/inspect_test.go index b86508514b..9c01fba511 100644 --- a/integration/container/inspect_test.go +++ b/integration/container/inspect_test.go @@ -8,7 +8,7 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/poll" diff --git a/integration/container/ipcmode_linux_test.go b/integration/container/ipcmode_linux_test.go index 2cb5f9b710..1a4160b374 100644 --- a/integration/container/ipcmode_linux_test.go +++ b/integration/container/ipcmode_linux_test.go @@ -14,8 +14,8 @@ import ( "github.com/docker/docker/api/types/versions" "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/daemon" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/daemon" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/fs" diff --git a/integration/container/kill_test.go b/integration/container/kill_test.go index b2c98a8a95..a2c8f3c6ff 100644 --- a/integration/container/kill_test.go +++ b/integration/container/kill_test.go @@ -7,7 +7,7 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/poll" diff --git a/integration/container/main_test.go b/integration/container/main_test.go index fb87fddcc2..bb7b2eb02f 100644 --- a/integration/container/main_test.go +++ b/integration/container/main_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var testEnv *environment.Execution diff --git a/integration/container/pause_test.go b/integration/container/pause_test.go index 5e91ee3bad..22a9b568bf 100644 --- a/integration/container/pause_test.go +++ b/integration/container/pause_test.go @@ -11,7 +11,7 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/versions" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/poll" diff --git a/integration/container/resize_test.go b/integration/container/resize_test.go index 27b5be4c70..2d18a19869 100644 --- a/integration/container/resize_test.go +++ b/integration/container/resize_test.go @@ -9,7 +9,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/versions" "github.com/docker/docker/integration/internal/container" - req "github.com/docker/docker/internal/test/request" + req "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/poll" diff --git a/integration/container/restart_test.go b/integration/container/restart_test.go index 3da30c0f3a..7ba120f14c 100644 --- a/integration/container/restart_test.go +++ b/integration/container/restart_test.go @@ -8,7 +8,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" - "github.com/docker/docker/internal/test/daemon" + "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" "gotest.tools/skip" ) diff --git a/integration/container/run_cgroupns_linux_test.go b/integration/container/run_cgroupns_linux_test.go index 65327877f7..64c18fa281 100644 --- a/integration/container/run_cgroupns_linux_test.go +++ b/integration/container/run_cgroupns_linux_test.go @@ -9,7 +9,7 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/integration/internal/requirement" - "github.com/docker/docker/internal/test/daemon" + "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/poll" diff --git a/integration/container/update_linux_test.go b/integration/container/update_linux_test.go index 3a72aba560..426d00950d 100644 --- a/integration/container/update_linux_test.go +++ b/integration/container/update_linux_test.go @@ -10,7 +10,7 @@ import ( containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/poll" diff --git a/integration/container/wait_test.go b/integration/container/wait_test.go index 53787d6c69..57d83d7525 100644 --- a/integration/container/wait_test.go +++ b/integration/container/wait_test.go @@ -6,7 +6,7 @@ import ( "time" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/poll" diff --git a/integration/image/import_test.go b/integration/image/import_test.go index bce55de0cf..c2b953ae25 100644 --- a/integration/image/import_test.go +++ b/integration/image/import_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/docker/docker/api/types" - "github.com/docker/docker/internal/test/daemon" - "github.com/docker/docker/internal/testutil" + "github.com/docker/docker/testutil" + "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" "gotest.tools/skip" ) diff --git a/integration/image/main_test.go b/integration/image/main_test.go index 1b4270dfc6..893e2fdf5d 100644 --- a/integration/image/main_test.go +++ b/integration/image/main_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var testEnv *environment.Execution diff --git a/integration/image/remove_unix_test.go b/integration/image/remove_unix_test.go index 428a312742..4dbd2eab94 100644 --- a/integration/image/remove_unix_test.go +++ b/integration/image/remove_unix_test.go @@ -14,8 +14,8 @@ import ( "unsafe" "github.com/docker/docker/api/types" - "github.com/docker/docker/internal/test/daemon" - "github.com/docker/docker/internal/test/fakecontext" + "github.com/docker/docker/testutil/daemon" + "github.com/docker/docker/testutil/fakecontext" "gotest.tools/assert" "gotest.tools/skip" ) diff --git a/integration/image/tag_test.go b/integration/image/tag_test.go index d237c48050..b2d28569ae 100644 --- a/integration/image/tag_test.go +++ b/integration/image/tag_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/docker/docker/internal/testutil" + "github.com/docker/docker/testutil" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/skip" diff --git a/integration/internal/swarm/service.go b/integration/internal/swarm/service.go index 28c30880c9..e7198266e6 100644 --- a/integration/internal/swarm/service.go +++ b/integration/internal/swarm/service.go @@ -10,8 +10,8 @@ import ( "github.com/docker/docker/api/types/filters" swarmtypes "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" - "github.com/docker/docker/internal/test/daemon" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/daemon" + "github.com/docker/docker/testutil/environment" "gotest.tools/assert" "gotest.tools/poll" "gotest.tools/skip" diff --git a/integration/network/ipvlan/ipvlan_test.go b/integration/network/ipvlan/ipvlan_test.go index e8cfb14d6e..dd04206597 100644 --- a/integration/network/ipvlan/ipvlan_test.go +++ b/integration/network/ipvlan/ipvlan_test.go @@ -15,7 +15,7 @@ import ( "github.com/docker/docker/integration/internal/container" net "github.com/docker/docker/integration/internal/network" n "github.com/docker/docker/integration/network" - "github.com/docker/docker/internal/test/daemon" + "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" "gotest.tools/skip" ) diff --git a/integration/network/ipvlan/main_test.go b/integration/network/ipvlan/main_test.go index 0936647959..20d149bbaa 100644 --- a/integration/network/ipvlan/main_test.go +++ b/integration/network/ipvlan/main_test.go @@ -7,7 +7,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var testEnv *environment.Execution diff --git a/integration/network/macvlan/macvlan_test.go b/integration/network/macvlan/macvlan_test.go index b734cad82e..f9d9e676d1 100644 --- a/integration/network/macvlan/macvlan_test.go +++ b/integration/network/macvlan/macvlan_test.go @@ -12,7 +12,7 @@ import ( "github.com/docker/docker/integration/internal/container" net "github.com/docker/docker/integration/internal/network" n "github.com/docker/docker/integration/network" - "github.com/docker/docker/internal/test/daemon" + "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" "gotest.tools/skip" ) diff --git a/integration/network/macvlan/main_test.go b/integration/network/macvlan/main_test.go index 15bdc323b5..85e48500c4 100644 --- a/integration/network/macvlan/main_test.go +++ b/integration/network/macvlan/main_test.go @@ -7,7 +7,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var testEnv *environment.Execution diff --git a/integration/network/main_test.go b/integration/network/main_test.go index 36ed19ca67..80354dcf0e 100644 --- a/integration/network/main_test.go +++ b/integration/network/main_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var testEnv *environment.Execution diff --git a/integration/network/network_test.go b/integration/network/network_test.go index b8c9cc43f8..b0a3afa107 100644 --- a/integration/network/network_test.go +++ b/integration/network/network_test.go @@ -10,8 +10,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/daemon" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/daemon" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/skip" diff --git a/integration/network/service_test.go b/integration/network/service_test.go index df2404c372..a4d54dfc72 100644 --- a/integration/network/service_test.go +++ b/integration/network/service_test.go @@ -11,7 +11,7 @@ import ( "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/network" "github.com/docker/docker/integration/internal/swarm" - "github.com/docker/docker/internal/test/daemon" + "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" "gotest.tools/icmd" "gotest.tools/poll" diff --git a/integration/plugin/authz/authz_plugin_test.go b/integration/plugin/authz/authz_plugin_test.go index 108cb837e8..211bf9f6cc 100644 --- a/integration/plugin/authz/authz_plugin_test.go +++ b/integration/plugin/authz/authz_plugin_test.go @@ -22,9 +22,9 @@ import ( eventtypes "github.com/docker/docker/api/types/events" "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/environment" "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/authorization" + "github.com/docker/docker/testutil/environment" "gotest.tools/assert" "gotest.tools/poll" "gotest.tools/skip" diff --git a/integration/plugin/authz/main_test.go b/integration/plugin/authz/main_test.go index 96c5901073..6edf3260d4 100644 --- a/integration/plugin/authz/main_test.go +++ b/integration/plugin/authz/main_test.go @@ -12,10 +12,10 @@ import ( "strings" "testing" - "github.com/docker/docker/internal/test/daemon" - "github.com/docker/docker/internal/test/environment" "github.com/docker/docker/pkg/authorization" "github.com/docker/docker/pkg/plugins" + "github.com/docker/docker/testutil/daemon" + "github.com/docker/docker/testutil/environment" "gotest.tools/skip" ) diff --git a/integration/plugin/common/main_test.go b/integration/plugin/common/main_test.go index 47400129b6..5bcbac2a83 100644 --- a/integration/plugin/common/main_test.go +++ b/integration/plugin/common/main_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var testEnv *environment.Execution diff --git a/integration/plugin/common/plugin_test.go b/integration/plugin/common/plugin_test.go index 5b6bfef765..6e2a5e9e90 100644 --- a/integration/plugin/common/plugin_test.go +++ b/integration/plugin/common/plugin_test.go @@ -4,7 +4,7 @@ import ( "net/http" "testing" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" ) diff --git a/integration/plugin/graphdriver/external_test.go b/integration/plugin/graphdriver/external_test.go index c89f9961d1..d72210be3e 100644 --- a/integration/plugin/graphdriver/external_test.go +++ b/integration/plugin/graphdriver/external_test.go @@ -19,9 +19,9 @@ import ( "github.com/docker/docker/daemon/graphdriver/vfs" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/integration/internal/requirement" - "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/plugins" + "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/skip" diff --git a/integration/plugin/graphdriver/main_test.go b/integration/plugin/graphdriver/main_test.go index 6b6c1a1232..21dd9beba0 100644 --- a/integration/plugin/graphdriver/main_test.go +++ b/integration/plugin/graphdriver/main_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" "github.com/docker/docker/pkg/reexec" + "github.com/docker/docker/testutil/environment" ) var ( diff --git a/integration/plugin/logging/helpers_test.go b/integration/plugin/logging/helpers_test.go index 128bf7d73b..ec5ae42273 100644 --- a/integration/plugin/logging/helpers_test.go +++ b/integration/plugin/logging/helpers_test.go @@ -9,8 +9,8 @@ import ( "time" "github.com/docker/docker/api/types" - "github.com/docker/docker/internal/test/fixtures/plugin" "github.com/docker/docker/pkg/locker" + "github.com/docker/docker/testutil/fixtures/plugin" "github.com/pkg/errors" ) diff --git a/integration/plugin/logging/logging_linux_test.go b/integration/plugin/logging/logging_linux_test.go index 1bb2d9419b..3ee66fdc77 100644 --- a/integration/plugin/logging/logging_linux_test.go +++ b/integration/plugin/logging/logging_linux_test.go @@ -10,7 +10,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/daemon" + "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" "gotest.tools/skip" ) diff --git a/integration/plugin/logging/main_test.go b/integration/plugin/logging/main_test.go index e1292a5718..40a41b9b2c 100644 --- a/integration/plugin/logging/main_test.go +++ b/integration/plugin/logging/main_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var ( diff --git a/integration/plugin/logging/validation_test.go b/integration/plugin/logging/validation_test.go index dfa50132d2..07f8c21ce8 100644 --- a/integration/plugin/logging/validation_test.go +++ b/integration/plugin/logging/validation_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/docker/docker/api/types" - "github.com/docker/docker/internal/test/daemon" + "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" "gotest.tools/skip" ) diff --git a/integration/plugin/volumes/helpers_test.go b/integration/plugin/volumes/helpers_test.go index 8d0b06bb9d..1238ae62d5 100644 --- a/integration/plugin/volumes/helpers_test.go +++ b/integration/plugin/volumes/helpers_test.go @@ -9,8 +9,8 @@ import ( "time" "github.com/docker/docker/api/types" - "github.com/docker/docker/internal/test/fixtures/plugin" "github.com/docker/docker/pkg/locker" + "github.com/docker/docker/testutil/fixtures/plugin" "github.com/pkg/errors" "gotest.tools/assert" ) diff --git a/integration/plugin/volumes/main_test.go b/integration/plugin/volumes/main_test.go index 5a5678d9c4..fe0a07938b 100644 --- a/integration/plugin/volumes/main_test.go +++ b/integration/plugin/volumes/main_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var ( diff --git a/integration/plugin/volumes/mounts_test.go b/integration/plugin/volumes/mounts_test.go index ab2d585ca7..e3165c22f2 100644 --- a/integration/plugin/volumes/mounts_test.go +++ b/integration/plugin/volumes/mounts_test.go @@ -7,8 +7,8 @@ import ( "testing" "github.com/docker/docker/api/types" - "github.com/docker/docker/internal/test/daemon" - "github.com/docker/docker/internal/test/fixtures/plugin" + "github.com/docker/docker/testutil/daemon" + "github.com/docker/docker/testutil/fixtures/plugin" "gotest.tools/assert" "gotest.tools/skip" ) diff --git a/integration/secret/main_test.go b/integration/secret/main_test.go index abd4eef9f0..a0cc4d889c 100644 --- a/integration/secret/main_test.go +++ b/integration/secret/main_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var testEnv *environment.Execution diff --git a/integration/service/create_test.go b/integration/service/create_test.go index 47e1b3f4dc..ecc7f5565c 100644 --- a/integration/service/create_test.go +++ b/integration/service/create_test.go @@ -15,7 +15,7 @@ import ( "github.com/docker/docker/errdefs" "github.com/docker/docker/integration/internal/network" "github.com/docker/docker/integration/internal/swarm" - "github.com/docker/docker/internal/test/daemon" + "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/poll" diff --git a/integration/service/main_test.go b/integration/service/main_test.go index 28fd19df4d..939c5ac897 100644 --- a/integration/service/main_test.go +++ b/integration/service/main_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var testEnv *environment.Execution diff --git a/integration/service/plugin_test.go b/integration/service/plugin_test.go index b30f224e09..3be6a38ff2 100644 --- a/integration/service/plugin_test.go +++ b/integration/service/plugin_test.go @@ -14,9 +14,9 @@ import ( swarmtypes "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/swarm/runtime" "github.com/docker/docker/integration/internal/swarm" - "github.com/docker/docker/internal/test/daemon" - "github.com/docker/docker/internal/test/fixtures/plugin" - "github.com/docker/docker/internal/test/registry" + "github.com/docker/docker/testutil/daemon" + "github.com/docker/docker/testutil/fixtures/plugin" + "github.com/docker/docker/testutil/registry" "gotest.tools/assert" "gotest.tools/poll" "gotest.tools/skip" diff --git a/integration/session/main_test.go b/integration/session/main_test.go index fc33025efe..766bd512b3 100644 --- a/integration/session/main_test.go +++ b/integration/session/main_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var testEnv *environment.Execution diff --git a/integration/session/session_test.go b/integration/session/session_test.go index 2f8d79c0e7..3b16afb86b 100644 --- a/integration/session/session_test.go +++ b/integration/session/session_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/docker/docker/api/types/versions" - req "github.com/docker/docker/internal/test/request" + req "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/skip" diff --git a/integration/system/cgroupdriver_systemd_test.go b/integration/system/cgroupdriver_systemd_test.go index b277ccaa08..1019532397 100644 --- a/integration/system/cgroupdriver_systemd_test.go +++ b/integration/system/cgroupdriver_systemd_test.go @@ -7,7 +7,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/daemon" + "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" "gotest.tools/skip" diff --git a/integration/system/event_test.go b/integration/system/event_test.go index 61adeedc4b..162dd80e13 100644 --- a/integration/system/event_test.go +++ b/integration/system/event_test.go @@ -15,9 +15,9 @@ import ( "github.com/docker/docker/api/types/strslice" "github.com/docker/docker/api/types/versions" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/request" - req "github.com/docker/docker/internal/test/request" "github.com/docker/docker/pkg/jsonmessage" + "github.com/docker/docker/testutil/request" + req "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/skip" diff --git a/integration/system/info_linux_test.go b/integration/system/info_linux_test.go index cb0448e558..434373b369 100644 --- a/integration/system/info_linux_test.go +++ b/integration/system/info_linux_test.go @@ -7,7 +7,7 @@ import ( "net/http" "testing" - req "github.com/docker/docker/internal/test/request" + req "github.com/docker/docker/testutil/request" "gotest.tools/assert" is "gotest.tools/assert/cmp" ) diff --git a/integration/system/info_test.go b/integration/system/info_test.go index 8130361988..56a735714e 100644 --- a/integration/system/info_test.go +++ b/integration/system/info_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/docker/docker/internal/test/daemon" + "github.com/docker/docker/testutil/daemon" "gotest.tools/assert" is "gotest.tools/assert/cmp" "gotest.tools/skip" diff --git a/integration/system/main_test.go b/integration/system/main_test.go index f19a3157aa..6dd4761cd5 100644 --- a/integration/system/main_test.go +++ b/integration/system/main_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var testEnv *environment.Execution diff --git a/integration/system/ping_test.go b/integration/system/ping_test.go index 9858bfd9da..2bbd7d2ad9 100644 --- a/integration/system/ping_test.go +++ b/integration/system/ping_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/docker/docker/api/types/versions" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "gotest.tools/assert" "gotest.tools/skip" ) diff --git a/integration/volume/main_test.go b/integration/volume/main_test.go index 206f7377ae..e3e9935207 100644 --- a/integration/volume/main_test.go +++ b/integration/volume/main_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/docker/docker/internal/test/environment" + "github.com/docker/docker/testutil/environment" ) var testEnv *environment.Execution diff --git a/integration/volume/volume_test.go b/integration/volume/volume_test.go index 0336b943bc..e5f2fba398 100644 --- a/integration/volume/volume_test.go +++ b/integration/volume/volume_test.go @@ -12,7 +12,7 @@ import ( "github.com/docker/docker/api/types/filters" volumetypes "github.com/docker/docker/api/types/volume" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/request" + "github.com/docker/docker/testutil/request" "github.com/google/go-cmp/cmp/cmpopts" "gotest.tools/assert" is "gotest.tools/assert/cmp" diff --git a/internal/test/daemon/config.go b/testutil/daemon/config.go similarity index 88% rename from internal/test/daemon/config.go rename to testutil/daemon/config.go index ce99222b37..4e09df1425 100644 --- a/internal/test/daemon/config.go +++ b/testutil/daemon/config.go @@ -5,7 +5,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" - "github.com/docker/docker/internal/test" + "github.com/docker/docker/testutil" "gotest.tools/assert" ) @@ -14,7 +14,7 @@ type ConfigConstructor func(*swarm.Config) // CreateConfig creates a config given the specified spec func (d *Daemon) CreateConfig(t assert.TestingT, configSpec swarm.ConfigSpec) string { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -27,7 +27,7 @@ func (d *Daemon) CreateConfig(t assert.TestingT, configSpec swarm.ConfigSpec) st // ListConfigs returns the list of the current swarm configs func (d *Daemon) ListConfigs(t assert.TestingT) []swarm.Config { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -40,7 +40,7 @@ func (d *Daemon) ListConfigs(t assert.TestingT) []swarm.Config { // GetConfig returns a swarm config identified by the specified id func (d *Daemon) GetConfig(t assert.TestingT, id string) *swarm.Config { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -53,7 +53,7 @@ func (d *Daemon) GetConfig(t assert.TestingT, id string) *swarm.Config { // DeleteConfig removes the swarm config identified by the specified id func (d *Daemon) DeleteConfig(t assert.TestingT, id string) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -66,7 +66,7 @@ func (d *Daemon) DeleteConfig(t assert.TestingT, id string) { // UpdateConfig updates the swarm config identified by the specified id // Currently, only label update is supported. func (d *Daemon) UpdateConfig(t assert.TestingT, id string, f ...ConfigConstructor) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) diff --git a/internal/test/daemon/container.go b/testutil/daemon/container.go similarity index 87% rename from internal/test/daemon/container.go rename to testutil/daemon/container.go index 3aa69e195c..0abc52cc71 100644 --- a/internal/test/daemon/container.go +++ b/testutil/daemon/container.go @@ -4,13 +4,13 @@ import ( "context" "github.com/docker/docker/api/types" - "github.com/docker/docker/internal/test" + "github.com/docker/docker/testutil" "gotest.tools/assert" ) // ActiveContainers returns the list of ids of the currently running containers func (d *Daemon) ActiveContainers(t assert.TestingT) []string { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -28,7 +28,7 @@ func (d *Daemon) ActiveContainers(t assert.TestingT) []string { // FindContainerIP returns the ip of the specified container func (d *Daemon) FindContainerIP(t assert.TestingT, id string) string { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) diff --git a/internal/test/daemon/daemon.go b/testutil/daemon/daemon.go similarity index 97% rename from internal/test/daemon/daemon.go rename to testutil/daemon/daemon.go index b3ea876ccc..544fae299b 100644 --- a/internal/test/daemon/daemon.go +++ b/testutil/daemon/daemon.go @@ -1,4 +1,4 @@ -package daemon // import "github.com/docker/docker/internal/test/daemon" +package daemon // import "github.com/docker/docker/testutil/daemon" import ( "context" @@ -17,11 +17,11 @@ import ( "github.com/docker/docker/api/types/events" "github.com/docker/docker/client" "github.com/docker/docker/daemon/images" - "github.com/docker/docker/internal/test" - "github.com/docker/docker/internal/test/request" "github.com/docker/docker/opts" "github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/stringid" + "github.com/docker/docker/testutil" + "github.com/docker/docker/testutil/request" "github.com/docker/go-connections/sockets" "github.com/docker/go-connections/tlsconfig" "github.com/pkg/errors" @@ -95,7 +95,7 @@ type Daemon struct { // This will create a directory such as d123456789 in the folder specified by $DOCKER_INTEGRATION_DAEMON_DEST or $DEST. // The daemon will not automatically start. func New(t testingT, ops ...func(*Daemon)) *Daemon { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } dest := os.Getenv("DOCKER_INTEGRATION_DAEMON_DEST") @@ -191,7 +191,7 @@ func (d *Daemon) ReadLogFile() ([]byte, error) { // NewClientT creates new client based on daemon's socket path func (d *Daemon) NewClientT(t assert.TestingT, extraOpts ...client.Opt) *client.Client { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } @@ -208,7 +208,7 @@ func (d *Daemon) NewClientT(t assert.TestingT, extraOpts ...client.Opt) *client. // Cleanup cleans the daemon files : exec root (network namespaces, ...), swarmkit files func (d *Daemon) Cleanup(t testingT) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } // Cleanup swarmkit wal files if present @@ -218,7 +218,7 @@ func (d *Daemon) Cleanup(t testingT) { // Start starts the daemon and return once it is ready to receive requests. func (d *Daemon) Start(t testingT, args ...string) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } if err := d.StartWithError(args...); err != nil { @@ -374,7 +374,7 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error { // StartWithBusybox will first start the daemon with Daemon.Start() // then save the busybox image from the main daemon and load it into this Daemon instance. func (d *Daemon) StartWithBusybox(t testingT, arg ...string) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } d.Start(t, arg...) @@ -433,7 +433,7 @@ func (d *Daemon) DumpStackAndQuit() { // instantiate a new one with NewDaemon. // If an error occurs while starting the daemon, the test will fail. func (d *Daemon) Stop(t testingT) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } err := d.StopWithError() @@ -521,7 +521,7 @@ out2: // Restart will restart the daemon by first stopping it and the starting it. // If an error occurs while starting the daemon, the test will fail. func (d *Daemon) Restart(t testingT, args ...string) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } d.Stop(t) @@ -597,7 +597,7 @@ func (d *Daemon) ReloadConfig() error { // LoadBusybox image into the daemon func (d *Daemon) LoadBusybox(t assert.TestingT) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } clientHost, err := client.NewClientWithOpts(client.FromEnv) @@ -711,7 +711,7 @@ func (d *Daemon) queryRootDir() (string, error) { // Info returns the info struct for this daemon func (d *Daemon) Info(t assert.TestingT) types.Info { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } c := d.NewClientT(t) @@ -721,7 +721,7 @@ func (d *Daemon) Info(t assert.TestingT) types.Info { } func cleanupRaftDir(t testingT, rootPath string) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } for _, p := range []string{"wal", "wal-v3-encrypted", "snap-v3-encrypted"} { diff --git a/internal/test/daemon/daemon_unix.go b/testutil/daemon/daemon_unix.go similarity index 89% rename from internal/test/daemon/daemon_unix.go rename to testutil/daemon/daemon_unix.go index 7c2b15c1ad..7936e3878d 100644 --- a/internal/test/daemon/daemon_unix.go +++ b/testutil/daemon/daemon_unix.go @@ -1,6 +1,6 @@ // +build !windows -package daemon // import "github.com/docker/docker/internal/test/daemon" +package daemon // import "github.com/docker/docker/testutil/daemon" import ( "fmt" @@ -8,13 +8,13 @@ import ( "path/filepath" "strings" - "github.com/docker/docker/internal/test" + "github.com/docker/docker/testutil" "golang.org/x/sys/unix" "gotest.tools/assert" ) func cleanupNetworkNamespace(t testingT, execRoot string) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } // Cleanup network namespaces in the exec root of this diff --git a/internal/test/daemon/daemon_windows.go b/testutil/daemon/daemon_windows.go similarity index 91% rename from internal/test/daemon/daemon_windows.go rename to testutil/daemon/daemon_windows.go index a7e987c92f..4d7226edec 100644 --- a/internal/test/daemon/daemon_windows.go +++ b/testutil/daemon/daemon_windows.go @@ -1,4 +1,4 @@ -package daemon // import "github.com/docker/docker/internal/test/daemon" +package daemon import ( "fmt" diff --git a/testutil/daemon/doc.go b/testutil/daemon/doc.go new file mode 100644 index 0000000000..add30e3cfb --- /dev/null +++ b/testutil/daemon/doc.go @@ -0,0 +1,2 @@ +// Package daemon launches dockerd for testing purposes. +package daemon // import "github.com/docker/docker/testutil/daemon" diff --git a/internal/test/daemon/node.go b/testutil/daemon/node.go similarity index 90% rename from internal/test/daemon/node.go rename to testutil/daemon/node.go index d5f6f15263..45ff2b5207 100644 --- a/internal/test/daemon/node.go +++ b/testutil/daemon/node.go @@ -7,7 +7,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" - "github.com/docker/docker/internal/test" + "github.com/docker/docker/testutil" "gotest.tools/assert" ) @@ -16,7 +16,7 @@ type NodeConstructor func(*swarm.Node) // GetNode returns a swarm node identified by the specified id func (d *Daemon) GetNode(t assert.TestingT, id string, errCheck ...func(error) bool) *swarm.Node { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -37,7 +37,7 @@ func (d *Daemon) GetNode(t assert.TestingT, id string, errCheck ...func(error) b // RemoveNode removes the specified node func (d *Daemon) RemoveNode(t assert.TestingT, id string, force bool) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -52,7 +52,7 @@ func (d *Daemon) RemoveNode(t assert.TestingT, id string, force bool) { // UpdateNode updates a swarm node with the specified node constructor func (d *Daemon) UpdateNode(t assert.TestingT, id string, f ...NodeConstructor) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -76,7 +76,7 @@ func (d *Daemon) UpdateNode(t assert.TestingT, id string, f ...NodeConstructor) // ListNodes returns the list of the current swarm nodes func (d *Daemon) ListNodes(t assert.TestingT) []swarm.Node { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) diff --git a/internal/test/daemon/ops.go b/testutil/daemon/ops.go similarity index 93% rename from internal/test/daemon/ops.go rename to testutil/daemon/ops.go index 9f869dee0f..546c639c09 100644 --- a/internal/test/daemon/ops.go +++ b/testutil/daemon/ops.go @@ -1,6 +1,6 @@ package daemon -import "github.com/docker/docker/internal/test/environment" +import "github.com/docker/docker/testutil/environment" // WithDefaultCgroupNamespaceMode sets the default cgroup namespace mode for the daemon func WithDefaultCgroupNamespaceMode(mode string) func(*Daemon) { @@ -62,7 +62,7 @@ func WithSwarmDataPathPort(datapathPort uint32) func(*Daemon) { } } -// WithEnvironment sets options from internal/test/environment.Execution struct +// WithEnvironment sets options from testutil/environment.Execution struct func WithEnvironment(e environment.Execution) func(*Daemon) { return func(d *Daemon) { if e.DaemonInfo.ExperimentalBuild { diff --git a/internal/test/daemon/ops_unix.go b/testutil/daemon/ops_unix.go similarity index 100% rename from internal/test/daemon/ops_unix.go rename to testutil/daemon/ops_unix.go diff --git a/internal/test/daemon/plugin.go b/testutil/daemon/plugin.go similarity index 100% rename from internal/test/daemon/plugin.go rename to testutil/daemon/plugin.go diff --git a/internal/test/daemon/secret.go b/testutil/daemon/secret.go similarity index 88% rename from internal/test/daemon/secret.go rename to testutil/daemon/secret.go index f3db7a4260..dedbf3df34 100644 --- a/internal/test/daemon/secret.go +++ b/testutil/daemon/secret.go @@ -5,7 +5,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" - "github.com/docker/docker/internal/test" + "github.com/docker/docker/testutil" "gotest.tools/assert" ) @@ -14,7 +14,7 @@ type SecretConstructor func(*swarm.Secret) // CreateSecret creates a secret given the specified spec func (d *Daemon) CreateSecret(t assert.TestingT, secretSpec swarm.SecretSpec) string { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -28,7 +28,7 @@ func (d *Daemon) CreateSecret(t assert.TestingT, secretSpec swarm.SecretSpec) st // ListSecrets returns the list of the current swarm secrets func (d *Daemon) ListSecrets(t assert.TestingT) []swarm.Secret { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -41,7 +41,7 @@ func (d *Daemon) ListSecrets(t assert.TestingT) []swarm.Secret { // GetSecret returns a swarm secret identified by the specified id func (d *Daemon) GetSecret(t assert.TestingT, id string) *swarm.Secret { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -54,7 +54,7 @@ func (d *Daemon) GetSecret(t assert.TestingT, id string) *swarm.Secret { // DeleteSecret removes the swarm secret identified by the specified id func (d *Daemon) DeleteSecret(t assert.TestingT, id string) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -67,7 +67,7 @@ func (d *Daemon) DeleteSecret(t assert.TestingT, id string) { // UpdateSecret updates the swarm secret identified by the specified id // Currently, only label update is supported. func (d *Daemon) UpdateSecret(t assert.TestingT, id string, f ...SecretConstructor) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) diff --git a/internal/test/daemon/service.go b/testutil/daemon/service.go similarity index 90% rename from internal/test/daemon/service.go rename to testutil/daemon/service.go index a51671639c..b8ea06fcc1 100644 --- a/internal/test/daemon/service.go +++ b/testutil/daemon/service.go @@ -7,7 +7,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm" - "github.com/docker/docker/internal/test" + "github.com/docker/docker/testutil" "gotest.tools/assert" ) @@ -15,7 +15,7 @@ import ( type ServiceConstructor func(*swarm.Service) func (d *Daemon) createServiceWithOptions(t assert.TestingT, opts types.ServiceCreateOptions, f ...ServiceConstructor) string { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } var service swarm.Service @@ -36,7 +36,7 @@ func (d *Daemon) createServiceWithOptions(t assert.TestingT, opts types.ServiceC // CreateService creates a swarm service given the specified service constructor func (d *Daemon) CreateService(t assert.TestingT, f ...ServiceConstructor) string { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } return d.createServiceWithOptions(t, types.ServiceCreateOptions{}, f...) @@ -44,7 +44,7 @@ func (d *Daemon) CreateService(t assert.TestingT, f ...ServiceConstructor) strin // GetService returns the swarm service corresponding to the specified id func (d *Daemon) GetService(t assert.TestingT, id string) *swarm.Service { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -57,7 +57,7 @@ func (d *Daemon) GetService(t assert.TestingT, id string) *swarm.Service { // GetServiceTasks returns the swarm tasks for the specified service func (d *Daemon) GetServiceTasks(t assert.TestingT, service string, additionalFilters ...filters.KeyValuePair) []swarm.Task { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -81,7 +81,7 @@ func (d *Daemon) GetServiceTasks(t assert.TestingT, service string, additionalFi // UpdateService updates a swarm service with the specified service constructor func (d *Daemon) UpdateService(t assert.TestingT, service *swarm.Service, f ...ServiceConstructor) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -97,7 +97,7 @@ func (d *Daemon) UpdateService(t assert.TestingT, service *swarm.Service, f ...S // RemoveService removes the specified service func (d *Daemon) RemoveService(t assert.TestingT, id string) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -109,7 +109,7 @@ func (d *Daemon) RemoveService(t assert.TestingT, id string) { // ListServices returns the list of the current swarm services func (d *Daemon) ListServices(t assert.TestingT) []swarm.Service { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -122,7 +122,7 @@ func (d *Daemon) ListServices(t assert.TestingT) []swarm.Service { // GetTask returns the swarm task identified by the specified id func (d *Daemon) GetTask(t assert.TestingT, id string) swarm.Task { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) diff --git a/internal/test/daemon/swarm.go b/testutil/daemon/swarm.go similarity index 91% rename from internal/test/daemon/swarm.go rename to testutil/daemon/swarm.go index 20300a1f4a..1bb30e23ae 100644 --- a/internal/test/daemon/swarm.go +++ b/testutil/daemon/swarm.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/docker/docker/api/types/swarm" - "github.com/docker/docker/internal/test" + "github.com/docker/docker/testutil" "github.com/pkg/errors" "gotest.tools/assert" ) @@ -22,7 +22,7 @@ var ( // StartNode (re)starts the daemon func (d *Daemon) StartNode(t testingT) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } d.Start(t, startArgs...) @@ -30,7 +30,7 @@ func (d *Daemon) StartNode(t testingT) { // StartNodeWithBusybox starts daemon to be used as a swarm node, and loads the busybox image func (d *Daemon) StartNodeWithBusybox(t testingT) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } d.StartWithBusybox(t, startArgs...) @@ -38,7 +38,7 @@ func (d *Daemon) StartNodeWithBusybox(t testingT) { // RestartNode restarts a daemon to be used as a swarm node func (d *Daemon) RestartNode(t testingT) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } // avoid networking conflicts @@ -54,7 +54,7 @@ func (d *Daemon) StartAndSwarmInit(t testingT) { // StartAndSwarmJoin starts the daemon (with busybox) and join the specified swarm as worker or manager func (d *Daemon) StartAndSwarmJoin(t testingT, leader *Daemon, manager bool) { - if th, ok := t.(test.HelperT); ok { + if th, ok := t.(testutil.HelperT); ok { th.Helper() } d.StartNodeWithBusybox(t) @@ -86,7 +86,7 @@ func (d *Daemon) NodeID() string { // SwarmInit initializes a new swarm cluster. func (d *Daemon) SwarmInit(t assert.TestingT, req swarm.InitRequest) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } if req.ListenAddr == "" { @@ -108,7 +108,7 @@ func (d *Daemon) SwarmInit(t assert.TestingT, req swarm.InitRequest) { // SwarmJoin joins a daemon to an existing cluster. func (d *Daemon) SwarmJoin(t assert.TestingT, req swarm.JoinRequest) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } if req.ListenAddr == "" { @@ -134,7 +134,7 @@ func (d *Daemon) SwarmLeave(t assert.TestingT, force bool) error { // SwarmInfo returns the swarm information of the daemon func (d *Daemon) SwarmInfo(t assert.TestingT) swarm.Info { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -161,7 +161,7 @@ func (d *Daemon) SwarmUnlock(t assert.TestingT, req swarm.UnlockRequest) error { // GetSwarm returns the current swarm object func (d *Daemon) GetSwarm(t assert.TestingT) swarm.Swarm { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -174,7 +174,7 @@ func (d *Daemon) GetSwarm(t assert.TestingT) swarm.Swarm { // UpdateSwarm updates the current swarm object with the specified spec constructors func (d *Daemon) UpdateSwarm(t assert.TestingT, f ...SpecConstructor) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -191,7 +191,7 @@ func (d *Daemon) UpdateSwarm(t assert.TestingT, f ...SpecConstructor) { // RotateTokens update the swarm to rotate tokens func (d *Daemon) RotateTokens(t assert.TestingT) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) @@ -211,7 +211,7 @@ func (d *Daemon) RotateTokens(t assert.TestingT) { // JoinTokens returns the current swarm join tokens func (d *Daemon) JoinTokens(t assert.TestingT) swarm.JoinTokens { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } cli := d.NewClientT(t) diff --git a/testutil/doc.go b/testutil/doc.go new file mode 100644 index 0000000000..1bf03ef3ff --- /dev/null +++ b/testutil/doc.go @@ -0,0 +1,2 @@ +// Package testutil contains common testing tasks like running dockerd. +package testutil // import "github.com/docker/docker/testutil" diff --git a/internal/test/environment/clean.go b/testutil/environment/clean.go similarity index 91% rename from internal/test/environment/clean.go rename to testutil/environment/clean.go index ad6ec93e4a..f3677697a7 100644 --- a/internal/test/environment/clean.go +++ b/testutil/environment/clean.go @@ -1,4 +1,4 @@ -package environment // import "github.com/docker/docker/internal/test/environment" +package environment // import "github.com/docker/docker/testutil/environment" import ( "context" @@ -8,7 +8,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/client" - "github.com/docker/docker/internal/test" + "github.com/docker/docker/testutil" "gotest.tools/assert" ) @@ -16,7 +16,7 @@ import ( // and removing everything else. It's meant to run after any tests so that they don't // depend on each others. func (e *Execution) Clean(t assert.TestingT) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } client := e.APIClient() @@ -35,7 +35,7 @@ func (e *Execution) Clean(t assert.TestingT) { } func unpauseAllContainers(t assert.TestingT, client client.ContainerAPIClient) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } ctx := context.Background() @@ -49,7 +49,7 @@ func unpauseAllContainers(t assert.TestingT, client client.ContainerAPIClient) { } func getPausedContainers(ctx context.Context, t assert.TestingT, client client.ContainerAPIClient) []types.Container { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } filter := filters.NewArgs() @@ -66,7 +66,7 @@ func getPausedContainers(ctx context.Context, t assert.TestingT, client client.C var alreadyExists = regexp.MustCompile(`Error response from daemon: removal of container (\w+) is already in progress`) func deleteAllContainers(t assert.TestingT, apiclient client.ContainerAPIClient, protectedContainers map[string]struct{}) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } ctx := context.Background() @@ -91,7 +91,7 @@ func deleteAllContainers(t assert.TestingT, apiclient client.ContainerAPIClient, } func getAllContainers(ctx context.Context, t assert.TestingT, client client.ContainerAPIClient) []types.Container { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } containers, err := client.ContainerList(ctx, types.ContainerListOptions{ @@ -103,7 +103,7 @@ func getAllContainers(ctx context.Context, t assert.TestingT, client client.Cont } func deleteAllImages(t assert.TestingT, apiclient client.ImageAPIClient, protectedImages map[string]struct{}) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } images, err := apiclient.ImageList(context.Background(), types.ImageListOptions{}) @@ -125,7 +125,7 @@ func deleteAllImages(t assert.TestingT, apiclient client.ImageAPIClient, protect } func removeImage(ctx context.Context, t assert.TestingT, apiclient client.ImageAPIClient, ref string) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } _, err := apiclient.ImageRemove(ctx, ref, types.ImageRemoveOptions{ @@ -138,7 +138,7 @@ func removeImage(ctx context.Context, t assert.TestingT, apiclient client.ImageA } func deleteAllVolumes(t assert.TestingT, c client.VolumeAPIClient, protectedVolumes map[string]struct{}) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } volumes, err := c.VolumeList(context.Background(), filters.Args{}) @@ -158,7 +158,7 @@ func deleteAllVolumes(t assert.TestingT, c client.VolumeAPIClient, protectedVolu } func deleteAllNetworks(t assert.TestingT, c client.NetworkAPIClient, daemonPlatform string, protectedNetworks map[string]struct{}) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } networks, err := c.NetworkList(context.Background(), types.NetworkListOptions{}) @@ -181,7 +181,7 @@ func deleteAllNetworks(t assert.TestingT, c client.NetworkAPIClient, daemonPlatf } func deleteAllPlugins(t assert.TestingT, c client.PluginAPIClient, protectedPlugins map[string]struct{}) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } plugins, err := c.PluginList(context.Background(), filters.Args{}) diff --git a/internal/test/environment/environment.go b/testutil/environment/environment.go similarity index 96% rename from internal/test/environment/environment.go rename to testutil/environment/environment.go index 3310590e7c..61f165e509 100644 --- a/internal/test/environment/environment.go +++ b/testutil/environment/environment.go @@ -1,4 +1,4 @@ -package environment // import "github.com/docker/docker/internal/test/environment" +package environment // import "github.com/docker/docker/testutil/environment" import ( "context" @@ -10,8 +10,8 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/client" - "github.com/docker/docker/internal/test" - "github.com/docker/docker/internal/test/fixtures/load" + "github.com/docker/docker/testutil" + "github.com/docker/docker/testutil/fixtures/load" "github.com/pkg/errors" "gotest.tools/assert" ) @@ -166,7 +166,7 @@ func (e *Execution) IsUserNamespace() bool { // Note that this is done by filtering and then checking whether there were any // results -- so ambiguous references might result in false-positives. func (e *Execution) HasExistingImage(t assert.TestingT, reference string) bool { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } client := e.APIClient() diff --git a/internal/test/environment/protect.go b/testutil/environment/protect.go similarity index 89% rename from internal/test/environment/protect.go rename to testutil/environment/protect.go index a47ea3c2fd..9fda6f5aa0 100644 --- a/internal/test/environment/protect.go +++ b/testutil/environment/protect.go @@ -1,4 +1,4 @@ -package environment // import "github.com/docker/docker/internal/test/environment" +package environment import ( "context" @@ -6,7 +6,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" dclient "github.com/docker/docker/client" - "github.com/docker/docker/internal/test" + "github.com/docker/docker/testutil" "gotest.tools/assert" ) @@ -34,7 +34,7 @@ func newProtectedElements() protectedElements { // volumes, and, on Linux, plugins) from being cleaned up at the end of test // runs func ProtectAll(t assert.TestingT, testEnv *Execution) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } ProtectContainers(t, testEnv) @@ -49,7 +49,7 @@ func ProtectAll(t assert.TestingT, testEnv *Execution) { // ProtectContainer adds the specified container(s) to be protected in case of // clean func (e *Execution) ProtectContainer(t assert.TestingT, containers ...string) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } for _, container := range containers { @@ -60,7 +60,7 @@ func (e *Execution) ProtectContainer(t assert.TestingT, containers ...string) { // ProtectContainers protects existing containers from being cleaned up at the // end of test runs func ProtectContainers(t assert.TestingT, testEnv *Execution) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } containers := getExistingContainers(t, testEnv) @@ -68,7 +68,7 @@ func ProtectContainers(t assert.TestingT, testEnv *Execution) { } func getExistingContainers(t assert.TestingT, testEnv *Execution) []string { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } client := testEnv.APIClient() @@ -86,7 +86,7 @@ func getExistingContainers(t assert.TestingT, testEnv *Execution) []string { // ProtectImage adds the specified image(s) to be protected in case of clean func (e *Execution) ProtectImage(t assert.TestingT, images ...string) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } for _, image := range images { @@ -97,7 +97,7 @@ func (e *Execution) ProtectImage(t assert.TestingT, images ...string) { // ProtectImages protects existing images and on linux frozen images from being // cleaned up at the end of test runs func ProtectImages(t assert.TestingT, testEnv *Execution) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } images := getExistingImages(t, testEnv) @@ -109,7 +109,7 @@ func ProtectImages(t assert.TestingT, testEnv *Execution) { } func getExistingImages(t assert.TestingT, testEnv *Execution) []string { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } client := testEnv.APIClient() @@ -146,7 +146,7 @@ func tagsFromImageSummary(image types.ImageSummary) []string { // ProtectNetwork adds the specified network(s) to be protected in case of // clean func (e *Execution) ProtectNetwork(t assert.TestingT, networks ...string) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } for _, network := range networks { @@ -157,7 +157,7 @@ func (e *Execution) ProtectNetwork(t assert.TestingT, networks ...string) { // ProtectNetworks protects existing networks from being cleaned up at the end // of test runs func ProtectNetworks(t assert.TestingT, testEnv *Execution) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } networks := getExistingNetworks(t, testEnv) @@ -165,7 +165,7 @@ func ProtectNetworks(t assert.TestingT, testEnv *Execution) { } func getExistingNetworks(t assert.TestingT, testEnv *Execution) []string { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } client := testEnv.APIClient() @@ -181,7 +181,7 @@ func getExistingNetworks(t assert.TestingT, testEnv *Execution) []string { // ProtectPlugin adds the specified plugin(s) to be protected in case of clean func (e *Execution) ProtectPlugin(t assert.TestingT, plugins ...string) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } for _, plugin := range plugins { @@ -192,7 +192,7 @@ func (e *Execution) ProtectPlugin(t assert.TestingT, plugins ...string) { // ProtectPlugins protects existing plugins from being cleaned up at the end of // test runs func ProtectPlugins(t assert.TestingT, testEnv *Execution) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } plugins := getExistingPlugins(t, testEnv) @@ -200,7 +200,7 @@ func ProtectPlugins(t assert.TestingT, testEnv *Execution) { } func getExistingPlugins(t assert.TestingT, testEnv *Execution) []string { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } client := testEnv.APIClient() @@ -220,7 +220,7 @@ func getExistingPlugins(t assert.TestingT, testEnv *Execution) []string { // ProtectVolume adds the specified volume(s) to be protected in case of clean func (e *Execution) ProtectVolume(t assert.TestingT, volumes ...string) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } for _, volume := range volumes { @@ -231,7 +231,7 @@ func (e *Execution) ProtectVolume(t assert.TestingT, volumes ...string) { // ProtectVolumes protects existing volumes from being cleaned up at the end of // test runs func ProtectVolumes(t assert.TestingT, testEnv *Execution) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } volumes := getExistingVolumes(t, testEnv) @@ -239,7 +239,7 @@ func ProtectVolumes(t assert.TestingT, testEnv *Execution) { } func getExistingVolumes(t assert.TestingT, testEnv *Execution) []string { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } client := testEnv.APIClient() diff --git a/internal/test/fakecontext/context.go b/testutil/fakecontext/context.go similarity index 93% rename from internal/test/fakecontext/context.go rename to testutil/fakecontext/context.go index 8b11da207e..88eda54486 100644 --- a/internal/test/fakecontext/context.go +++ b/testutil/fakecontext/context.go @@ -1,4 +1,4 @@ -package fakecontext // import "github.com/docker/docker/internal/test/fakecontext" +package fakecontext // import "github.com/docker/docker/testutil/fakecontext" import ( "bytes" @@ -7,8 +7,8 @@ import ( "os" "path/filepath" - "github.com/docker/docker/internal/test" "github.com/docker/docker/pkg/archive" + "github.com/docker/docker/testutil" ) type testingT interface { @@ -18,7 +18,7 @@ type testingT interface { // New creates a fake build context func New(t testingT, dir string, modifiers ...func(*Fake) error) *Fake { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } fakeContext := &Fake{Dir: dir} @@ -120,7 +120,7 @@ func (f *Fake) Close() error { // AsTarReader returns a ReadCloser with the contents of Dir as a tar archive. func (f *Fake) AsTarReader(t testingT) io.ReadCloser { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } reader, err := archive.TarWithOptions(f.Dir, &archive.TarOptions{}) diff --git a/internal/test/fakegit/fakegit.go b/testutil/fakegit/fakegit.go similarity index 92% rename from internal/test/fakegit/fakegit.go rename to testutil/fakegit/fakegit.go index 30de769743..dde0127c60 100644 --- a/internal/test/fakegit/fakegit.go +++ b/testutil/fakegit/fakegit.go @@ -1,4 +1,4 @@ -package fakegit // import "github.com/docker/docker/internal/test/fakegit" +package fakegit // import "github.com/docker/docker/testutil/fakegit" import ( "fmt" @@ -9,9 +9,9 @@ import ( "os/exec" "path/filepath" - "github.com/docker/docker/internal/test" - "github.com/docker/docker/internal/test/fakecontext" - "github.com/docker/docker/internal/test/fakestorage" + "github.com/docker/docker/testutil" + "github.com/docker/docker/testutil/fakecontext" + "github.com/docker/docker/testutil/fakestorage" "gotest.tools/assert" ) @@ -64,7 +64,7 @@ func (g *FakeGit) Close() { // New create a fake git server that can be used for git related tests func New(c testingT, name string, files map[string]string, enforceLocalServer bool) *FakeGit { - if ht, ok := c.(test.HelperT); ok { + if ht, ok := c.(testutil.HelperT); ok { ht.Helper() } ctx := fakecontext.New(c, "", fakecontext.WithFiles(files)) diff --git a/internal/test/fakestorage/fixtures.go b/testutil/fakestorage/fixtures.go similarity index 93% rename from internal/test/fakestorage/fixtures.go rename to testutil/fakestorage/fixtures.go index ad8f763143..fa1f0081fc 100644 --- a/internal/test/fakestorage/fixtures.go +++ b/testutil/fakestorage/fixtures.go @@ -1,4 +1,4 @@ -package fakestorage // import "github.com/docker/docker/internal/test/fakestorage" +package fakestorage // import "github.com/docker/docker/testutil/fakestorage" import ( "context" @@ -10,15 +10,15 @@ import ( "sync" "github.com/docker/docker/api/types" - "github.com/docker/docker/internal/test" "github.com/docker/docker/pkg/archive" + "github.com/docker/docker/testutil" "gotest.tools/assert" ) var ensureHTTPServerOnce sync.Once func ensureHTTPServerImage(t testingT) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } var doIt bool diff --git a/internal/test/fakestorage/storage.go b/testutil/fakestorage/storage.go similarity index 93% rename from internal/test/fakestorage/storage.go rename to testutil/fakestorage/storage.go index e229fd0813..4175908b85 100644 --- a/internal/test/fakestorage/storage.go +++ b/testutil/fakestorage/storage.go @@ -1,4 +1,4 @@ -package fakestorage // import "github.com/docker/docker/internal/test/fakestorage" +package fakestorage // import "github.com/docker/docker/testutil/fakestorage" import ( "context" @@ -14,11 +14,10 @@ import ( "github.com/docker/docker/api/types" containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/client" - "github.com/docker/docker/internal/test" - "github.com/docker/docker/internal/test/environment" - "github.com/docker/docker/internal/test/fakecontext" - "github.com/docker/docker/internal/test/request" - "github.com/docker/docker/internal/testutil" + "github.com/docker/docker/testutil" + "github.com/docker/docker/testutil/environment" + "github.com/docker/docker/testutil/fakecontext" + "github.com/docker/docker/testutil/request" "github.com/docker/go-connections/nat" "gotest.tools/assert" ) @@ -57,7 +56,7 @@ func SetTestEnvironment(env *environment.Execution) { // New returns a static file server that will be use as build context. func New(t testingT, dir string, modifiers ...func(*fakecontext.Fake) error) Fake { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } if testEnv == nil { diff --git a/internal/test/fixtures/load/frozen.go b/testutil/fixtures/load/frozen.go similarity index 98% rename from internal/test/fixtures/load/frozen.go rename to testutil/fixtures/load/frozen.go index 94f3680f95..4e8589e442 100644 --- a/internal/test/fixtures/load/frozen.go +++ b/testutil/fixtures/load/frozen.go @@ -1,4 +1,4 @@ -package load // import "github.com/docker/docker/internal/test/fixtures/load" +package load // import "github.com/docker/docker/testutil/fixtures/load" import ( "bufio" diff --git a/internal/test/fixtures/plugin/basic/basic.go b/testutil/fixtures/plugin/basic/basic.go similarity index 100% rename from internal/test/fixtures/plugin/basic/basic.go rename to testutil/fixtures/plugin/basic/basic.go diff --git a/internal/test/fixtures/plugin/plugin.go b/testutil/fixtures/plugin/plugin.go similarity index 97% rename from internal/test/fixtures/plugin/plugin.go rename to testutil/fixtures/plugin/plugin.go index 93f5f99fed..8517b37afb 100644 --- a/internal/test/fixtures/plugin/plugin.go +++ b/testutil/fixtures/plugin/plugin.go @@ -1,4 +1,4 @@ -package plugin // import "github.com/docker/docker/internal/test/fixtures/plugin" +package plugin // import "github.com/docker/docker/testutil/fixtures/plugin" import ( "context" @@ -206,7 +206,7 @@ func ensureBasicPluginBin() (string, error) { return "", err } installPath := filepath.Join(os.Getenv("GOPATH"), "bin", name) - sourcePath := filepath.Join("github.com", "docker", "docker", "internal", "test", "fixtures", "plugin", "basic") + sourcePath := filepath.Join("github.com", "docker", "docker", "testutil", "fixtures", "plugin", "basic") cmd := exec.Command(goBin, "build", "-o", installPath, sourcePath) cmd.Env = append(os.Environ(), "CGO_ENABLED=0") if out, err := cmd.CombinedOutput(); err != nil { diff --git a/internal/test/helper.go b/testutil/helper.go similarity index 86% rename from internal/test/helper.go rename to testutil/helper.go index 1b9fd75090..a8a70e4dfb 100644 --- a/internal/test/helper.go +++ b/testutil/helper.go @@ -1,4 +1,4 @@ -package test +package testutil // HelperT is a subset of testing.T that implements the Helper function type HelperT interface { diff --git a/internal/testutil/helpers.go b/testutil/helpers.go similarity index 77% rename from internal/testutil/helpers.go rename to testutil/helpers.go index 38cd1693f5..e522b5a9a4 100644 --- a/internal/testutil/helpers.go +++ b/testutil/helpers.go @@ -1,4 +1,4 @@ -package testutil // import "github.com/docker/docker/internal/testutil" +package testutil // import "github.com/docker/docker/testutil" import ( "io" diff --git a/internal/test/registry/ops.go b/testutil/registry/ops.go similarity index 100% rename from internal/test/registry/ops.go rename to testutil/registry/ops.go diff --git a/internal/test/registry/registry.go b/testutil/registry/registry.go similarity index 95% rename from internal/test/registry/registry.go rename to testutil/registry/registry.go index b6128d3ba4..59af456a70 100644 --- a/internal/test/registry/registry.go +++ b/testutil/registry/registry.go @@ -1,4 +1,4 @@ -package registry // import "github.com/docker/docker/internal/test/registry" +package registry // import "github.com/docker/docker/testutil/registry" import ( "fmt" @@ -9,7 +9,7 @@ import ( "path/filepath" "time" - "github.com/docker/docker/internal/test" + "github.com/docker/docker/testutil" "github.com/opencontainers/go-digest" "gotest.tools/assert" ) @@ -55,7 +55,7 @@ type Config struct { // NewV2 creates a v2 registry server func NewV2(t testingT, ops ...func(*Config)) *V2 { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } c := &Config{ @@ -139,7 +139,7 @@ http: // WaitReady waits for the registry to be ready to serve requests (or fail after a while) func (r *V2) WaitReady(t testingT) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } var err error @@ -190,7 +190,7 @@ func (r *V2) getBlobFilename(blobDigest digest.Digest) string { // ReadBlobContents read the file corresponding to the specified digest func (r *V2) ReadBlobContents(t assert.TestingT, blobDigest digest.Digest) []byte { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } // Load the target manifest blob. @@ -201,7 +201,7 @@ func (r *V2) ReadBlobContents(t assert.TestingT, blobDigest digest.Digest) []byt // WriteBlobContents write the file corresponding to the specified digest with the given content func (r *V2) WriteBlobContents(t assert.TestingT, blobDigest digest.Digest, data []byte) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } err := ioutil.WriteFile(r.getBlobFilename(blobDigest), data, os.FileMode(0644)) @@ -211,7 +211,7 @@ func (r *V2) WriteBlobContents(t assert.TestingT, blobDigest digest.Digest, data // TempMoveBlobData moves the existing data file aside, so that we can replace it with a // malicious blob of data for example. func (r *V2) TempMoveBlobData(t testingT, blobDigest digest.Digest) (undo func()) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } tempFile, err := ioutil.TempFile("", "registry-temp-blob-") diff --git a/internal/test/registry/registry_mock.go b/testutil/registry/registry_mock.go similarity index 89% rename from internal/test/registry/registry_mock.go rename to testutil/registry/registry_mock.go index d139401a62..cb0498a8ab 100644 --- a/internal/test/registry/registry_mock.go +++ b/testutil/registry/registry_mock.go @@ -1,4 +1,4 @@ -package registry // import "github.com/docker/docker/internal/test/registry" +package registry // import "github.com/docker/docker/testutil/registry" import ( "net/http" @@ -7,7 +7,7 @@ import ( "strings" "sync" - "github.com/docker/docker/internal/test" + "github.com/docker/docker/testutil" ) type handlerFunc func(w http.ResponseWriter, r *http.Request) @@ -29,7 +29,7 @@ func (tr *Mock) RegisterHandler(path string, h handlerFunc) { // NewMock creates a registry mock func NewMock(t testingT) (*Mock, error) { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } testReg := &Mock{handlers: make(map[string]handlerFunc)} diff --git a/internal/test/request/npipe.go b/testutil/request/npipe.go similarity index 100% rename from internal/test/request/npipe.go rename to testutil/request/npipe.go diff --git a/internal/test/request/npipe_windows.go b/testutil/request/npipe_windows.go similarity index 100% rename from internal/test/request/npipe_windows.go rename to testutil/request/npipe_windows.go diff --git a/internal/test/request/ops.go b/testutil/request/ops.go similarity index 100% rename from internal/test/request/ops.go rename to testutil/request/ops.go diff --git a/internal/test/request/request.go b/testutil/request/request.go similarity index 95% rename from internal/test/request/request.go rename to testutil/request/request.go index 6bf70c7437..5ee2c73c75 100644 --- a/internal/test/request/request.go +++ b/testutil/request/request.go @@ -1,4 +1,4 @@ -package request // import "github.com/docker/docker/internal/test/request" +package request // import "github.com/docker/docker/testutil/request" import ( "context" @@ -14,10 +14,10 @@ import ( "time" "github.com/docker/docker/client" - "github.com/docker/docker/internal/test" - "github.com/docker/docker/internal/test/environment" "github.com/docker/docker/opts" "github.com/docker/docker/pkg/ioutils" + "github.com/docker/docker/testutil" + "github.com/docker/docker/testutil/environment" "github.com/docker/go-connections/sockets" "github.com/docker/go-connections/tlsconfig" "github.com/pkg/errors" @@ -26,7 +26,7 @@ import ( // NewAPIClient returns a docker API client configured from environment variables func NewAPIClient(t assert.TestingT, ops ...client.Opt) client.APIClient { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } ops = append([]client.Opt{client.FromEnv}, ops...) @@ -37,7 +37,7 @@ func NewAPIClient(t assert.TestingT, ops ...client.Opt) client.APIClient { // DaemonTime provides the current time on the daemon host func DaemonTime(ctx context.Context, t assert.TestingT, client client.APIClient, testEnv *environment.Execution) time.Time { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } if testEnv.IsLocalDaemon() { @@ -55,7 +55,7 @@ func DaemonTime(ctx context.Context, t assert.TestingT, client client.APIClient, // DaemonUnixTime returns the current time on the daemon host with nanoseconds precision. // It return the time formatted how the client sends timestamps to the server. func DaemonUnixTime(ctx context.Context, t assert.TestingT, client client.APIClient, testEnv *environment.Execution) string { - if ht, ok := t.(test.HelperT); ok { + if ht, ok := t.(testutil.HelperT); ok { ht.Helper() } dt := DaemonTime(ctx, t, client, testEnv) diff --git a/internal/testutil/stringutils.go b/testutil/stringutils.go similarity index 83% rename from internal/testutil/stringutils.go rename to testutil/stringutils.go index 574aeb51f2..62092faa36 100644 --- a/internal/testutil/stringutils.go +++ b/testutil/stringutils.go @@ -1,4 +1,4 @@ -package testutil // import "github.com/docker/docker/internal/testutil" +package testutil // import "github.com/docker/docker/testutil" import "math/rand" diff --git a/internal/testutil/stringutils_test.go b/testutil/stringutils_test.go similarity index 91% rename from internal/testutil/stringutils_test.go rename to testutil/stringutils_test.go index 753aac966d..ee95997768 100644 --- a/internal/testutil/stringutils_test.go +++ b/testutil/stringutils_test.go @@ -1,4 +1,4 @@ -package testutil // import "github.com/docker/docker/internal/testutil" +package testutil // import "github.com/docker/docker/testutil" import ( "testing"