diff --git a/builder/dockerfile/evaluator_test.go b/builder/dockerfile/evaluator_test.go index 03d9270616..5c40fed558 100644 --- a/builder/dockerfile/evaluator_test.go +++ b/builder/dockerfile/evaluator_test.go @@ -21,8 +21,11 @@ type dispatchTestCase struct { files map[string]string } -func init() { - reexec.Init() +func TestMain(m *testing.M) { + if reexec.Init() { + return + } + os.Exit(m.Run()) } func TestDispatch(t *testing.T) { diff --git a/builder/remotecontext/tarsum_test.go b/builder/remotecontext/tarsum_test.go index a398839ab3..ca354d02f9 100644 --- a/builder/remotecontext/tarsum_test.go +++ b/builder/remotecontext/tarsum_test.go @@ -17,8 +17,11 @@ const ( contents = "contents test" ) -func init() { - reexec.Init() +func TestMain(m *testing.M) { + if reexec.Init() { + return + } + os.Exit(m.Run()) } func TestCloseRootDirectory(t *testing.T) { diff --git a/daemon/graphdriver/fuse-overlayfs/fuseoverlayfs_test.go b/daemon/graphdriver/fuse-overlayfs/fuseoverlayfs_test.go index 0d5b29e538..6c0ca01c5e 100644 --- a/daemon/graphdriver/fuse-overlayfs/fuseoverlayfs_test.go +++ b/daemon/graphdriver/fuse-overlayfs/fuseoverlayfs_test.go @@ -9,7 +9,6 @@ import ( "github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver/graphtest" "github.com/docker/docker/pkg/archive" - "github.com/docker/docker/pkg/reexec" ) func init() { @@ -17,8 +16,6 @@ func init() { // errors or hangs to be debugged directly from the test process. untar = archive.UntarUncompressed graphdriver.ApplyUncompressedLayer = archive.ApplyUncompressedLayer - - reexec.Init() } // This avoids creating a new driver for each test if all tests are run diff --git a/daemon/graphdriver/overlay2/overlay_test.go b/daemon/graphdriver/overlay2/overlay_test.go index 47f3f11005..fbf25fe75b 100644 --- a/daemon/graphdriver/overlay2/overlay_test.go +++ b/daemon/graphdriver/overlay2/overlay_test.go @@ -10,7 +10,6 @@ import ( "github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver/graphtest" "github.com/docker/docker/pkg/archive" - "github.com/docker/docker/pkg/reexec" ) func init() { @@ -18,8 +17,6 @@ func init() { // errors or hangs to be debugged directly from the test process. untar = archive.UntarUncompressed graphdriver.ApplyUncompressedLayer = archive.ApplyUncompressedLayer - - reexec.Init() } func skipIfNaive(t *testing.T) { diff --git a/daemon/graphdriver/vfs/vfs_test.go b/daemon/graphdriver/vfs/vfs_test.go index 63db564518..7cf0bf8cf6 100644 --- a/daemon/graphdriver/vfs/vfs_test.go +++ b/daemon/graphdriver/vfs/vfs_test.go @@ -7,14 +7,8 @@ import ( "testing" "github.com/docker/docker/daemon/graphdriver/graphtest" - - "github.com/docker/docker/pkg/reexec" ) -func init() { - reexec.Init() -} - // This avoids creating a new driver for each test if all tests are run // Make sure to put new tests between TestVfsSetup and TestVfsTeardown func TestVfsSetup(t *testing.T) { diff --git a/integration-cli/check_test.go b/integration-cli/check_test.go index 5353672f9c..db6683709d 100644 --- a/integration-cli/check_test.go +++ b/integration-cli/check_test.go @@ -18,7 +18,6 @@ import ( "github.com/docker/docker/integration-cli/daemon" "github.com/docker/docker/integration-cli/environment" "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" @@ -50,8 +49,6 @@ var ( func init() { var err error - reexec.Init() // This is required for external graphdriver tests - testEnv, err = environment.New() if err != nil { panic(err) diff --git a/integration/plugin/common/main_test.go b/integration/plugin/common/main_test.go index cd42c8f761..5bcbac2a83 100644 --- a/integration/plugin/common/main_test.go +++ b/integration/plugin/common/main_test.go @@ -5,16 +5,12 @@ import ( "os" "testing" - "github.com/docker/docker/pkg/reexec" "github.com/docker/docker/testutil/environment" ) var testEnv *environment.Execution func TestMain(m *testing.M) { - if reexec.Init() { - return - } var err error testEnv, err = environment.New() if err != nil { diff --git a/integration/plugin/graphdriver/main_test.go b/integration/plugin/graphdriver/main_test.go index 68fa02c81e..5114180fd7 100644 --- a/integration/plugin/graphdriver/main_test.go +++ b/integration/plugin/graphdriver/main_test.go @@ -5,7 +5,6 @@ import ( "os" "testing" - "github.com/docker/docker/pkg/reexec" "github.com/docker/docker/testutil/environment" ) @@ -13,10 +12,6 @@ var ( testEnv *environment.Execution ) -func init() { - reexec.Init() // This is required for external graphdriver tests -} - func TestMain(m *testing.M) { var err error testEnv, err = environment.New() diff --git a/libnetwork/cmd/readme_test/readme.go b/libnetwork/cmd/readme_test/readme.go index 7e008a9aa9..80cfae3a6c 100644 --- a/libnetwork/cmd/readme_test/readme.go +++ b/libnetwork/cmd/readme_test/readme.go @@ -8,14 +8,9 @@ import ( "github.com/docker/docker/libnetwork/config" "github.com/docker/docker/libnetwork/netlabel" "github.com/docker/docker/libnetwork/options" - "github.com/docker/docker/pkg/reexec" ) func main() { - if reexec.Init() { - return - } - // Select and configure the network driver networkType := "bridge" diff --git a/libnetwork/drivers/bridge/port_mapping_test.go b/libnetwork/drivers/bridge/port_mapping_test.go index dab375e96b..17d6e19b51 100644 --- a/libnetwork/drivers/bridge/port_mapping_test.go +++ b/libnetwork/drivers/bridge/port_mapping_test.go @@ -4,23 +4,14 @@ package bridge import ( - "os" "testing" "github.com/docker/docker/libnetwork/netlabel" "github.com/docker/docker/libnetwork/ns" "github.com/docker/docker/libnetwork/testutils" "github.com/docker/docker/libnetwork/types" - "github.com/docker/docker/pkg/reexec" ) -func TestMain(m *testing.M) { - if reexec.Init() { - return - } - os.Exit(m.Run()) -} - func TestPortMappingConfig(t *testing.T) { defer testutils.SetupTestOSContext(t)() d := newDriver() diff --git a/libnetwork/libnetwork_test.go b/libnetwork/libnetwork_test.go index 3707952ab9..e3207d4f5c 100644 --- a/libnetwork/libnetwork_test.go +++ b/libnetwork/libnetwork_test.go @@ -10,7 +10,6 @@ import ( "net/http/httptest" "os" "path/filepath" - "runtime" "testing" "github.com/docker/docker/libnetwork" @@ -23,19 +22,9 @@ import ( "github.com/docker/docker/libnetwork/testutils" "github.com/docker/docker/libnetwork/types" "github.com/docker/docker/pkg/plugins" - "github.com/docker/docker/pkg/reexec" - "github.com/sirupsen/logrus" ) func TestMain(m *testing.M) { - if runtime.GOOS == "windows" { - logrus.Info("Test suite does not currently support windows") - os.Exit(0) - } - if reexec.Init() { - return - } - // Cleanup local datastore file _ = os.Remove(datastore.DefaultScope("").Client.Address) diff --git a/libnetwork/osl/sandbox_linux_test.go b/libnetwork/osl/sandbox_linux_test.go index acda5eee9e..0dd8b1e8a5 100644 --- a/libnetwork/osl/sandbox_linux_test.go +++ b/libnetwork/osl/sandbox_linux_test.go @@ -15,7 +15,6 @@ import ( "github.com/docker/docker/libnetwork/ns" "github.com/docker/docker/libnetwork/testutils" "github.com/docker/docker/libnetwork/types" - "github.com/docker/docker/pkg/reexec" "github.com/vishvananda/netlink" "github.com/vishvananda/netlink/nl" "github.com/vishvananda/netns" @@ -382,13 +381,6 @@ func TestLiveRestore(t *testing.T) { } } -func TestMain(m *testing.M) { - if reexec.Init() { - return - } - os.Exit(m.Run()) -} - func TestSandboxCreate(t *testing.T) { defer testutils.SetupTestOSContext(t)() diff --git a/pkg/chrootarchive/archive_test.go b/pkg/chrootarchive/archive_test.go index 4e22ac6fd9..5ef8ef832b 100644 --- a/pkg/chrootarchive/archive_test.go +++ b/pkg/chrootarchive/archive_test.go @@ -14,14 +14,9 @@ import ( "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/idtools" - "github.com/docker/docker/pkg/reexec" "gotest.tools/v3/skip" ) -func init() { - reexec.Init() -} - var chrootArchiver = NewArchiver(idtools.IdentityMapping{}) func TarUntar(src, dst string) error {