Browse Source

Merge pull request #30138 from vdemeester/integration-use-testenv

[test-integration] Use testEnv methods and remove most of the global variables
Vincent Demeester 8 năm trước cách đây
mục cha
commit
4fdfcb36cd
40 tập tin đã thay đổi với 180 bổ sung231 xóa
  1. 12 63
      integration-cli/check_test.go
  2. 1 1
      integration-cli/docker_api_build_test.go
  3. 6 6
      integration-cli/docker_api_containers_test.go
  4. 2 2
      integration-cli/docker_api_images_test.go
  5. 1 1
      integration-cli/docker_api_inspect_test.go
  6. 3 3
      integration-cli/docker_api_stats_test.go
  7. 1 1
      integration-cli/docker_api_test.go
  8. 1 1
      integration-cli/docker_cli_authz_plugin_v2_test.go
  9. 1 1
      integration-cli/docker_cli_authz_unix_test.go
  10. 30 30
      integration-cli/docker_cli_build_test.go
  11. 2 2
      integration-cli/docker_cli_by_digest_test.go
  12. 1 1
      integration-cli/docker_cli_cp_to_container_unix_test.go
  13. 4 4
      integration-cli/docker_cli_create_test.go
  14. 4 4
      integration-cli/docker_cli_daemon_test.go
  15. 1 1
      integration-cli/docker_cli_diff_test.go
  16. 1 1
      integration-cli/docker_cli_events_test.go
  17. 1 1
      integration-cli/docker_cli_external_graphdriver_unix_test.go
  18. 1 1
      integration-cli/docker_cli_external_volume_driver_unix_test.go
  19. 1 1
      integration-cli/docker_cli_help_test.go
  20. 7 7
      integration-cli/docker_cli_info_test.go
  21. 4 4
      integration-cli/docker_cli_inspect_test.go
  22. 1 1
      integration-cli/docker_cli_network_unix_test.go
  23. 1 1
      integration-cli/docker_cli_plugins_test.go
  24. 1 1
      integration-cli/docker_cli_ps_test.go
  25. 1 1
      integration-cli/docker_cli_rename_test.go
  26. 1 1
      integration-cli/docker_cli_restart_test.go
  27. 2 2
      integration-cli/docker_cli_rmi_test.go
  28. 55 55
      integration-cli/docker_cli_run_test.go
  29. 2 2
      integration-cli/docker_cli_top_test.go
  30. 1 1
      integration-cli/docker_cli_update_test.go
  31. 4 4
      integration-cli/docker_deprecated_api_v124_test.go
  32. 1 1
      integration-cli/docker_hub_pull_suite_test.go
  33. 5 5
      integration-cli/docker_utils_test.go
  34. 1 2
      integration-cli/environment/environment.go
  35. 2 2
      integration-cli/fixtures_linux_daemon_test.go
  36. 1 1
      integration-cli/fixtures_test.go
  37. 11 11
      integration-cli/requirements_test.go
  38. 1 1
      integration-cli/requirements_unix_test.go
  39. 1 1
      integration-cli/test_vars_test.go
  40. 3 2
      integration-cli/utils_test.go

+ 12 - 63
integration-cli/check_test.go

@@ -11,7 +11,6 @@ import (
 	"syscall"
 	"syscall"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/api/types/swarm"
 	cliconfig "github.com/docker/docker/cli/config"
 	cliconfig "github.com/docker/docker/cli/config"
 	"github.com/docker/docker/integration-cli/daemon"
 	"github.com/docker/docker/integration-cli/daemon"
@@ -40,40 +39,6 @@ var (
 
 
 	// the docker client binary to use
 	// the docker client binary to use
 	dockerBinary = "docker"
 	dockerBinary = "docker"
-
-	// isLocalDaemon is true if the daemon under test is on the same
-	// host as the CLI.
-	isLocalDaemon bool
-	// daemonPlatform is held globally so that tests can make intelligent
-	// decisions on how to configure themselves according to the platform
-	// of the daemon. This is initialized in docker_utils by sending
-	// a version call to the daemon and examining the response header.
-	daemonPlatform string
-
-	// WindowsBaseImage is the name of the base image for Windows testing
-	// Environment variable WINDOWS_BASE_IMAGE can override this
-	WindowsBaseImage string
-
-	// For a local daemon on Linux, these values will be used for testing
-	// user namespace support as the standard graph path(s) will be
-	// appended with the root remapped uid.gid prefix
-	dockerBasePath       string
-	volumesConfigPath    string
-	containerStoragePath string
-
-	// daemonStorageDriver is held globally so that tests can know the storage
-	// driver of the daemon. This is initialized in docker_utils by sending
-	// a version call to the daemon and examining the response header.
-	daemonStorageDriver string
-
-	// isolation is the isolation mode of the daemon under test
-	isolation container.Isolation
-
-	// experimentalDaemon tell whether the main daemon has
-	// experimental features enabled or not
-	experimentalDaemon bool
-
-	daemonKernelVersion string
 )
 )
 
 
 func init() {
 func init() {
@@ -86,22 +51,6 @@ func init() {
 		fmt.Println(err)
 		fmt.Println(err)
 		os.Exit(1)
 		os.Exit(1)
 	}
 	}
-
-	assignGlobalVariablesFromTestEnv(testEnv)
-}
-
-// FIXME(vdemeester) remove this and use environment
-func assignGlobalVariablesFromTestEnv(testEnv *environment.Execution) {
-	isLocalDaemon = testEnv.LocalDaemon()
-	daemonPlatform = testEnv.DaemonPlatform()
-	dockerBasePath = testEnv.DockerBasePath()
-	volumesConfigPath = testEnv.VolumesConfigPath()
-	containerStoragePath = testEnv.ContainerStoragePath()
-	daemonStorageDriver = testEnv.DaemonStorageDriver()
-	isolation = testEnv.Isolation()
-	experimentalDaemon = testEnv.ExperimentalDaemon()
-	daemonKernelVersion = testEnv.DaemonKernelVersion()
-	WindowsBaseImage = testEnv.MinimalBaseImage()
 }
 }
 
 
 func TestMain(m *testing.M) {
 func TestMain(m *testing.M) {
@@ -125,17 +74,17 @@ func TestMain(m *testing.M) {
 	for _, img := range images {
 	for _, img := range images {
 		protectedImages[img] = struct{}{}
 		protectedImages[img] = struct{}{}
 	}
 	}
-	if !isLocalDaemon {
-		fmt.Println("INFO: Testing against a remote daemon")
-	} else {
+	if testEnv.LocalDaemon() {
 		fmt.Println("INFO: Testing against a local daemon")
 		fmt.Println("INFO: Testing against a local daemon")
+	} else {
+		fmt.Println("INFO: Testing against a remote daemon")
 	}
 	}
 	exitCode := m.Run()
 	exitCode := m.Run()
 	os.Exit(exitCode)
 	os.Exit(exitCode)
 }
 }
 
 
 func Test(t *testing.T) {
 func Test(t *testing.T) {
-	if daemonPlatform == "linux" {
+	if testEnv.DaemonPlatform() == "linux" {
 		ensureFrozenImagesLinux(t)
 		ensureFrozenImagesLinux(t)
 	}
 	}
 	check.TestingT(t)
 	check.TestingT(t)
@@ -149,7 +98,7 @@ type DockerSuite struct {
 }
 }
 
 
 func (s *DockerSuite) OnTimeout(c *check.C) {
 func (s *DockerSuite) OnTimeout(c *check.C) {
-	if testEnv.DaemonPID() > 0 && isLocalDaemon {
+	if testEnv.DaemonPID() > 0 && testEnv.LocalDaemon() {
 		daemon.SignalDaemonDump(testEnv.DaemonPID())
 		daemon.SignalDaemonDump(testEnv.DaemonPID())
 	}
 	}
 }
 }
@@ -160,7 +109,7 @@ func (s *DockerSuite) TearDownTest(c *check.C) {
 	deleteAllImages(c)
 	deleteAllImages(c)
 	deleteAllVolumes(c)
 	deleteAllVolumes(c)
 	deleteAllNetworks(c)
 	deleteAllNetworks(c)
-	if daemonPlatform == "linux" {
+	if testEnv.DaemonPlatform() == "linux" {
 		deleteAllPlugins(c)
 		deleteAllPlugins(c)
 	}
 	}
 }
 }
@@ -185,7 +134,7 @@ func (s *DockerRegistrySuite) SetUpTest(c *check.C) {
 	testRequires(c, DaemonIsLinux, registry.Hosting)
 	testRequires(c, DaemonIsLinux, registry.Hosting)
 	s.reg = setupRegistry(c, false, "", "")
 	s.reg = setupRegistry(c, false, "", "")
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 }
 }
 
 
@@ -219,7 +168,7 @@ func (s *DockerSchema1RegistrySuite) SetUpTest(c *check.C) {
 	testRequires(c, DaemonIsLinux, registry.Hosting, NotArm64)
 	testRequires(c, DaemonIsLinux, registry.Hosting, NotArm64)
 	s.reg = setupRegistry(c, true, "", "")
 	s.reg = setupRegistry(c, true, "", "")
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 }
 }
 
 
@@ -253,7 +202,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) SetUpTest(c *check.C) {
 	testRequires(c, DaemonIsLinux, registry.Hosting)
 	testRequires(c, DaemonIsLinux, registry.Hosting)
 	s.reg = setupRegistry(c, false, "htpasswd", "")
 	s.reg = setupRegistry(c, false, "htpasswd", "")
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 }
 }
 
 
@@ -288,7 +237,7 @@ func (s *DockerRegistryAuthTokenSuite) OnTimeout(c *check.C) {
 func (s *DockerRegistryAuthTokenSuite) SetUpTest(c *check.C) {
 func (s *DockerRegistryAuthTokenSuite) SetUpTest(c *check.C) {
 	testRequires(c, DaemonIsLinux, registry.Hosting)
 	testRequires(c, DaemonIsLinux, registry.Hosting)
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 }
 }
 
 
@@ -329,7 +278,7 @@ func (s *DockerDaemonSuite) OnTimeout(c *check.C) {
 func (s *DockerDaemonSuite) SetUpTest(c *check.C) {
 func (s *DockerDaemonSuite) SetUpTest(c *check.C) {
 	testRequires(c, DaemonIsLinux, SameHostDaemon)
 	testRequires(c, DaemonIsLinux, SameHostDaemon)
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 }
 }
 
 
@@ -387,7 +336,7 @@ func (s *DockerSwarmSuite) SetUpTest(c *check.C) {
 func (s *DockerSwarmSuite) AddDaemon(c *check.C, joinSwarm, manager bool) *daemon.Swarm {
 func (s *DockerSwarmSuite) AddDaemon(c *check.C, joinSwarm, manager bool) *daemon.Swarm {
 	d := &daemon.Swarm{
 	d := &daemon.Swarm{
 		Daemon: daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 		Daemon: daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-			Experimental: experimentalDaemon,
+			Experimental: testEnv.ExperimentalDaemon(),
 		}),
 		}),
 		Port: defaultSwarmPort + s.portIndex,
 		Port: defaultSwarmPort + s.portIndex,
 	}
 	}

+ 1 - 1
integration-cli/docker_api_build_test.go

@@ -16,7 +16,7 @@ import (
 func (s *DockerSuite) TestBuildAPIDockerFileRemote(c *check.C) {
 func (s *DockerSuite) TestBuildAPIDockerFileRemote(c *check.C) {
 	testRequires(c, NotUserNamespace)
 	testRequires(c, NotUserNamespace)
 	var testD string
 	var testD string
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		testD = `FROM busybox
 		testD = `FROM busybox
 COPY * /tmp/
 COPY * /tmp/
 RUN find / -name ba*
 RUN find / -name ba*

+ 6 - 6
integration-cli/docker_api_containers_test.go

@@ -919,7 +919,7 @@ func (s *DockerSuite) TestContainerAPIStart(c *check.C) {
 	c.Assert(err, checker.IsNil)
 	c.Assert(err, checker.IsNil)
 
 
 	// TODO(tibor): figure out why this doesn't work on windows
 	// TODO(tibor): figure out why this doesn't work on windows
-	if isLocalDaemon {
+	if testEnv.LocalDaemon() {
 		c.Assert(status, checker.Equals, http.StatusNotModified)
 		c.Assert(status, checker.Equals, http.StatusNotModified)
 	}
 	}
 }
 }
@@ -943,7 +943,7 @@ func (s *DockerSuite) TestContainerAPIWait(c *check.C) {
 	name := "test-api-wait"
 	name := "test-api-wait"
 
 
 	sleepCmd := "/bin/sleep"
 	sleepCmd := "/bin/sleep"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		sleepCmd = "sleep"
 		sleepCmd = "sleep"
 	}
 	}
 	dockerCmd(c, "run", "--name", name, "busybox", sleepCmd, "2")
 	dockerCmd(c, "run", "--name", name, "busybox", sleepCmd, "2")
@@ -1112,7 +1112,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *check.C) {
 	testRequires(c, SameHostDaemon)
 	testRequires(c, SameHostDaemon)
 
 
 	vol := "/testvolume"
 	vol := "/testvolume"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		vol = `c:\testvolume`
 		vol = `c:\testvolume`
 	}
 	}
 
 
@@ -1769,7 +1769,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsCreate(c *check.C) {
 		err     error
 		err     error
 		testImg string
 		testImg string
 	)
 	)
-	if daemonPlatform != "windows" {
+	if testEnv.DaemonPlatform() != "windows" {
 		testImg, err = buildImage("test-mount-config", `
 		testImg, err = buildImage("test-mount-config", `
 	FROM busybox
 	FROM busybox
 	RUN mkdir `+destPath+` && touch `+destPath+slash+`bar
 	RUN mkdir `+destPath+` && touch `+destPath+slash+`bar
@@ -1822,7 +1822,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsCreate(c *check.C) {
 		}
 		}
 	}
 	}
 
 
-	if daemonPlatform != "windows" { // Windows does not support volume populate
+	if testEnv.DaemonPlatform() != "windows" { // Windows does not support volume populate
 		cases = append(cases, []testCase{
 		cases = append(cases, []testCase{
 			{mounttypes.Mount{Type: "volume", Target: destPath, VolumeOptions: &mounttypes.VolumeOptions{NoCopy: true}}, types.MountPoint{Driver: volume.DefaultDriverName, Type: "volume", RW: true, Destination: destPath}},
 			{mounttypes.Mount{Type: "volume", Target: destPath, VolumeOptions: &mounttypes.VolumeOptions{NoCopy: true}}, types.MountPoint{Driver: volume.DefaultDriverName, Type: "volume", RW: true, Destination: destPath}},
 			{mounttypes.Mount{Type: "volume", Target: destPath + slash, VolumeOptions: &mounttypes.VolumeOptions{NoCopy: true}}, types.MountPoint{Driver: volume.DefaultDriverName, Type: "volume", RW: true, Destination: destPath}},
 			{mounttypes.Mount{Type: "volume", Target: destPath + slash, VolumeOptions: &mounttypes.VolumeOptions{NoCopy: true}}, types.MountPoint{Driver: volume.DefaultDriverName, Type: "volume", RW: true, Destination: destPath}},
@@ -1872,7 +1872,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsCreate(c *check.C) {
 		}
 		}
 
 
 		out, _, err := dockerCmdWithError("start", "-a", id)
 		out, _, err := dockerCmdWithError("start", "-a", id)
-		if (x.cfg.Type != "volume" || (x.cfg.VolumeOptions != nil && x.cfg.VolumeOptions.NoCopy)) && daemonPlatform != "windows" {
+		if (x.cfg.Type != "volume" || (x.cfg.VolumeOptions != nil && x.cfg.VolumeOptions.NoCopy)) && testEnv.DaemonPlatform() != "windows" {
 			c.Assert(err, checker.NotNil, check.Commentf("%s\n%v", out, mps[0]))
 			c.Assert(err, checker.NotNil, check.Commentf("%s\n%v", out, mps[0]))
 		} else {
 		} else {
 			c.Assert(err, checker.IsNil, check.Commentf("%s\n%v", out, mps[0]))
 			c.Assert(err, checker.IsNil, check.Commentf("%s\n%v", out, mps[0]))

+ 2 - 2
integration-cli/docker_api_images_test.go

@@ -73,7 +73,7 @@ func (s *DockerSuite) TestAPIImagesSaveAndLoad(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestAPIImagesDelete(c *check.C) {
 func (s *DockerSuite) TestAPIImagesDelete(c *check.C) {
-	if daemonPlatform != "windows" {
+	if testEnv.DaemonPlatform() != "windows" {
 		testRequires(c, Network)
 		testRequires(c, Network)
 	}
 	}
 	name := "test-api-images-delete"
 	name := "test-api-images-delete"
@@ -97,7 +97,7 @@ func (s *DockerSuite) TestAPIImagesDelete(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestAPIImagesHistory(c *check.C) {
 func (s *DockerSuite) TestAPIImagesHistory(c *check.C) {
-	if daemonPlatform != "windows" {
+	if testEnv.DaemonPlatform() != "windows" {
 		testRequires(c, Network)
 		testRequires(c, Network)
 	}
 	}
 	name := "test-api-images-history"
 	name := "test-api-images-history"

+ 1 - 1
integration-cli/docker_api_inspect_test.go

@@ -27,7 +27,7 @@ func (s *DockerSuite) TestInspectAPIContainerResponse(c *check.C) {
 
 
 	var cases []acase
 	var cases []acase
 
 
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		cases = []acase{
 		cases = []acase{
 			{"v1.25", append(keysBase, "Mounts")},
 			{"v1.25", append(keysBase, "Mounts")},
 		}
 		}

+ 3 - 3
integration-cli/docker_api_stats_test.go

@@ -38,7 +38,7 @@ func (s *DockerSuite) TestAPIStatsNoStreamGetCpu(c *check.C) {
 
 
 	var cpuPercent = 0.0
 	var cpuPercent = 0.0
 
 
-	if daemonPlatform != "windows" {
+	if testEnv.DaemonPlatform() != "windows" {
 		cpuDelta := float64(v.CPUStats.CPUUsage.TotalUsage - v.PreCPUStats.CPUUsage.TotalUsage)
 		cpuDelta := float64(v.CPUStats.CPUUsage.TotalUsage - v.PreCPUStats.CPUUsage.TotalUsage)
 		systemDelta := float64(v.CPUStats.SystemUsage - v.PreCPUStats.SystemUsage)
 		systemDelta := float64(v.CPUStats.SystemUsage - v.PreCPUStats.SystemUsage)
 		cpuPercent = (cpuDelta / systemDelta) * float64(len(v.CPUStats.CPUUsage.PercpuUsage)) * 100.0
 		cpuPercent = (cpuDelta / systemDelta) * float64(len(v.CPUStats.CPUUsage.PercpuUsage)) * 100.0
@@ -104,7 +104,7 @@ func (s *DockerSuite) TestAPIStatsNetworkStats(c *check.C) {
 
 
 	// Retrieve the container address
 	// Retrieve the container address
 	net := "bridge"
 	net := "bridge"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		net = "nat"
 		net = "nat"
 	}
 	}
 	contIP := findContainerIP(c, id, net)
 	contIP := findContainerIP(c, id, net)
@@ -152,7 +152,7 @@ func (s *DockerSuite) TestAPIStatsNetworkStats(c *check.C) {
 	// On Linux, account for ARP.
 	// On Linux, account for ARP.
 	expRxPkts := preRxPackets + uint64(numPings)
 	expRxPkts := preRxPackets + uint64(numPings)
 	expTxPkts := preTxPackets + uint64(numPings)
 	expTxPkts := preTxPackets + uint64(numPings)
-	if daemonPlatform != "windows" {
+	if testEnv.DaemonPlatform() != "windows" {
 		expRxPkts++
 		expRxPkts++
 		expTxPkts++
 		expTxPkts++
 	}
 	}

+ 1 - 1
integration-cli/docker_api_test.go

@@ -36,7 +36,7 @@ func (s *DockerSuite) TestAPIGetEnabledCORS(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestAPIClientVersionOldNotSupported(c *check.C) {
 func (s *DockerSuite) TestAPIClientVersionOldNotSupported(c *check.C) {
-	if daemonPlatform != runtime.GOOS {
+	if testEnv.DaemonPlatform() != runtime.GOOS {
 		c.Skip("Daemon platform doesn't match test platform")
 		c.Skip("Daemon platform doesn't match test platform")
 	}
 	}
 	if api.MinVersion == api.DefaultVersion {
 	if api.MinVersion == api.DefaultVersion {

+ 1 - 1
integration-cli/docker_cli_authz_plugin_v2_test.go

@@ -33,7 +33,7 @@ type DockerAuthzV2Suite struct {
 func (s *DockerAuthzV2Suite) SetUpTest(c *check.C) {
 func (s *DockerAuthzV2Suite) SetUpTest(c *check.C) {
 	testRequires(c, DaemonIsLinux, Network)
 	testRequires(c, DaemonIsLinux, Network)
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 	s.d.Start(c)
 	s.d.Start(c)
 }
 }

+ 1 - 1
integration-cli/docker_cli_authz_unix_test.go

@@ -65,7 +65,7 @@ type authorizationController struct {
 
 
 func (s *DockerAuthzSuite) SetUpTest(c *check.C) {
 func (s *DockerAuthzSuite) SetUpTest(c *check.C) {
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 	s.ctrl = &authorizationController{}
 	s.ctrl = &authorizationController{}
 }
 }

+ 30 - 30
integration-cli/docker_cli_build_test.go

@@ -36,7 +36,7 @@ func (s *DockerSuite) TestBuildJSONEmptyRun(c *check.C) {
 func (s *DockerSuite) TestBuildShCmdJSONEntrypoint(c *check.C) {
 func (s *DockerSuite) TestBuildShCmdJSONEntrypoint(c *check.C) {
 	name := "testbuildshcmdjsonentrypoint"
 	name := "testbuildshcmdjsonentrypoint"
 	expected := "/bin/sh -c echo test"
 	expected := "/bin/sh -c echo test"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expected = "cmd /S /C echo test"
 		expected = "cmd /S /C echo test"
 	}
 	}
 
 
@@ -74,7 +74,7 @@ func (s *DockerSuite) TestBuildEnvironmentReplacementVolume(c *check.C) {
 
 
 	var volumePath string
 	var volumePath string
 
 
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		volumePath = "c:/quux"
 		volumePath = "c:/quux"
 	} else {
 	} else {
 		volumePath = "/quux"
 		volumePath = "/quux"
@@ -131,7 +131,7 @@ func (s *DockerSuite) TestBuildEnvironmentReplacementWorkdir(c *check.C) {
 	res := inspectFieldJSON(c, name, "Config.WorkingDir")
 	res := inspectFieldJSON(c, name, "Config.WorkingDir")
 
 
 	expected := `"/work"`
 	expected := `"/work"`
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expected = `"C:\\work"`
 		expected = `"C:\\work"`
 	}
 	}
 	if res != expected {
 	if res != expected {
@@ -634,7 +634,7 @@ RUN [ $(cat "/test dir/test_file6") = 'test6' ]`, command, command, command, com
 
 
 func (s *DockerSuite) TestBuildCopyFileWithWhitespaceOnWindows(c *check.C) {
 func (s *DockerSuite) TestBuildCopyFileWithWhitespaceOnWindows(c *check.C) {
 	testRequires(c, DaemonIsWindows)
 	testRequires(c, DaemonIsWindows)
-	dockerfile := `FROM ` + WindowsBaseImage + `
+	dockerfile := `FROM ` + testEnv.MinimalBaseImage() + `
 RUN mkdir "C:/test dir"
 RUN mkdir "C:/test dir"
 RUN mkdir "C:/test_dir"
 RUN mkdir "C:/test_dir"
 COPY [ "test file1", "/test_file1" ]
 COPY [ "test file1", "/test_file1" ]
@@ -1387,7 +1387,7 @@ func (s *DockerSuite) TestBuildRelativeWorkdir(c *check.C) {
 		expectedFinal string
 		expectedFinal string
 	)
 	)
 
 
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expected1 = `C:/`
 		expected1 = `C:/`
 		expected2 = `C:/test1`
 		expected2 = `C:/test1`
 		expected3 = `C:/test2`
 		expected3 = `C:/test2`
@@ -1466,7 +1466,7 @@ func (s *DockerSuite) TestBuildWorkdirWithEnvVariables(c *check.C) {
 	name := "testbuildworkdirwithenvvariables"
 	name := "testbuildworkdirwithenvvariables"
 
 
 	var expected string
 	var expected string
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expected = `C:\test1\test2`
 		expected = `C:\test1\test2`
 	} else {
 	} else {
 		expected = `/test1/test2`
 		expected = `/test1/test2`
@@ -1488,7 +1488,7 @@ func (s *DockerSuite) TestBuildRelativeCopy(c *check.C) {
 	testRequires(c, NotUserNamespace)
 	testRequires(c, NotUserNamespace)
 
 
 	var expected string
 	var expected string
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expected = `C:/test1/test2`
 		expected = `C:/test1/test2`
 	} else {
 	} else {
 		expected = `/test1/test2`
 		expected = `/test1/test2`
@@ -1597,7 +1597,7 @@ func (s *DockerSuite) TestBuildContextCleanup(c *check.C) {
 	testRequires(c, SameHostDaemon)
 	testRequires(c, SameHostDaemon)
 
 
 	name := "testbuildcontextcleanup"
 	name := "testbuildcontextcleanup"
-	entries, err := ioutil.ReadDir(filepath.Join(dockerBasePath, "tmp"))
+	entries, err := ioutil.ReadDir(filepath.Join(testEnv.DockerBasePath(), "tmp"))
 	if err != nil {
 	if err != nil {
 		c.Fatalf("failed to list contents of tmp dir: %s", err)
 		c.Fatalf("failed to list contents of tmp dir: %s", err)
 	}
 	}
@@ -1605,7 +1605,7 @@ func (s *DockerSuite) TestBuildContextCleanup(c *check.C) {
 	buildImageSuccessfully(c, name, withDockerfile(`FROM `+minimalBaseImage()+`
 	buildImageSuccessfully(c, name, withDockerfile(`FROM `+minimalBaseImage()+`
         ENTRYPOINT ["/bin/echo"]`))
         ENTRYPOINT ["/bin/echo"]`))
 
 
-	entriesFinal, err := ioutil.ReadDir(filepath.Join(dockerBasePath, "tmp"))
+	entriesFinal, err := ioutil.ReadDir(filepath.Join(testEnv.DockerBasePath(), "tmp"))
 	if err != nil {
 	if err != nil {
 		c.Fatalf("failed to list contents of tmp dir: %s", err)
 		c.Fatalf("failed to list contents of tmp dir: %s", err)
 	}
 	}
@@ -1619,7 +1619,7 @@ func (s *DockerSuite) TestBuildContextCleanupFailedBuild(c *check.C) {
 	testRequires(c, SameHostDaemon)
 	testRequires(c, SameHostDaemon)
 
 
 	name := "testbuildcontextcleanup"
 	name := "testbuildcontextcleanup"
-	entries, err := ioutil.ReadDir(filepath.Join(dockerBasePath, "tmp"))
+	entries, err := ioutil.ReadDir(filepath.Join(testEnv.DockerBasePath(), "tmp"))
 	if err != nil {
 	if err != nil {
 		c.Fatalf("failed to list contents of tmp dir: %s", err)
 		c.Fatalf("failed to list contents of tmp dir: %s", err)
 	}
 	}
@@ -1629,7 +1629,7 @@ func (s *DockerSuite) TestBuildContextCleanupFailedBuild(c *check.C) {
 		ExitCode: 1,
 		ExitCode: 1,
 	})
 	})
 
 
-	entriesFinal, err := ioutil.ReadDir(filepath.Join(dockerBasePath, "tmp"))
+	entriesFinal, err := ioutil.ReadDir(filepath.Join(testEnv.DockerBasePath(), "tmp"))
 	if err != nil {
 	if err != nil {
 		c.Fatalf("failed to list contents of tmp dir: %s", err)
 		c.Fatalf("failed to list contents of tmp dir: %s", err)
 	}
 	}
@@ -2253,7 +2253,7 @@ func (s *DockerSuite) TestBuildAddFileNotFound(c *check.C) {
 	name := "testbuildaddnotfound"
 	name := "testbuildaddnotfound"
 	expected := "foo: no such file or directory"
 	expected := "foo: no such file or directory"
 
 
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expected = "foo: The system cannot find the file specified"
 		expected = "foo: The system cannot find the file specified"
 	}
 	}
 
 
@@ -2307,7 +2307,7 @@ func (s *DockerSuite) TestBuildOnBuild(c *check.C) {
 // gh #2446
 // gh #2446
 func (s *DockerSuite) TestBuildAddToSymlinkDest(c *check.C) {
 func (s *DockerSuite) TestBuildAddToSymlinkDest(c *check.C) {
 	makeLink := `ln -s /foo /bar`
 	makeLink := `ln -s /foo /bar`
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		makeLink = `mklink /D C:\bar C:\foo`
 		makeLink = `mklink /D C:\bar C:\foo`
 	}
 	}
 	name := "testbuildaddtosymlinkdest"
 	name := "testbuildaddtosymlinkdest"
@@ -3299,7 +3299,7 @@ func (s *DockerSuite) TestBuildCmdShDashC(c *check.C) {
 
 
 	res := inspectFieldJSON(c, name, "Config.Cmd")
 	res := inspectFieldJSON(c, name, "Config.Cmd")
 	expected := `["/bin/sh","-c","echo cmd"]`
 	expected := `["/bin/sh","-c","echo cmd"]`
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expected = `["cmd","/S","/C","echo cmd"]`
 		expected = `["cmd","/S","/C","echo cmd"]`
 	}
 	}
 	if res != expected {
 	if res != expected {
@@ -3374,7 +3374,7 @@ func (s *DockerSuite) TestBuildEntrypointCanBeOverridenByChildInspect(c *check.C
 		expected = `["/bin/sh","-c","echo quux"]`
 		expected = `["/bin/sh","-c","echo quux"]`
 	)
 	)
 
 
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expected = `["cmd","/S","/C","echo quux"]`
 		expected = `["cmd","/S","/C","echo quux"]`
 	}
 	}
 
 
@@ -3431,7 +3431,7 @@ func (s *DockerSuite) TestBuildVerifySingleQuoteFails(c *check.C) {
 	// it should barf on it.
 	// it should barf on it.
 	name := "testbuildsinglequotefails"
 	name := "testbuildsinglequotefails"
 	expectedExitCode := 2
 	expectedExitCode := 2
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expectedExitCode = 127
 		expectedExitCode = 127
 	}
 	}
 
 
@@ -3447,7 +3447,7 @@ func (s *DockerSuite) TestBuildVerboseOut(c *check.C) {
 	name := "testbuildverboseout"
 	name := "testbuildverboseout"
 	expected := "\n123\n"
 	expected := "\n123\n"
 
 
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expected = "\n123\r\n"
 		expected = "\n123\r\n"
 	}
 	}
 
 
@@ -3463,7 +3463,7 @@ func (s *DockerSuite) TestBuildWithTabs(c *check.C) {
 	res := inspectFieldJSON(c, name, "ContainerConfig.Cmd")
 	res := inspectFieldJSON(c, name, "ContainerConfig.Cmd")
 	expected1 := `["/bin/sh","-c","echo\tone\t\ttwo"]`
 	expected1 := `["/bin/sh","-c","echo\tone\t\ttwo"]`
 	expected2 := `["/bin/sh","-c","echo\u0009one\u0009\u0009two"]` // syntactically equivalent, and what Go 1.3 generates
 	expected2 := `["/bin/sh","-c","echo\u0009one\u0009\u0009two"]` // syntactically equivalent, and what Go 1.3 generates
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expected1 = `["cmd","/S","/C","echo\tone\t\ttwo"]`
 		expected1 = `["cmd","/S","/C","echo\tone\t\ttwo"]`
 		expected2 = `["cmd","/S","/C","echo\u0009one\u0009\u0009two"]` // syntactically equivalent, and what Go 1.3 generates
 		expected2 = `["cmd","/S","/C","echo\u0009one\u0009\u0009two"]` // syntactically equivalent, and what Go 1.3 generates
 	}
 	}
@@ -3656,7 +3656,7 @@ func (s *DockerSuite) TestBuildStderr(c *check.C) {
 	result.Assert(c, icmd.Success)
 	result.Assert(c, icmd.Success)
 
 
 	// Windows to non-Windows should have a security warning
 	// Windows to non-Windows should have a security warning
-	if runtime.GOOS == "windows" && daemonPlatform != "windows" && !strings.Contains(result.Stdout(), "SECURITY WARNING:") {
+	if runtime.GOOS == "windows" && testEnv.DaemonPlatform() != "windows" && !strings.Contains(result.Stdout(), "SECURITY WARNING:") {
 		c.Fatalf("Stdout contains unexpected output: %q", result.Stdout())
 		c.Fatalf("Stdout contains unexpected output: %q", result.Stdout())
 	}
 	}
 
 
@@ -3775,7 +3775,7 @@ func (s *DockerSuite) TestBuildVolumesRetainContents(c *check.C) {
 		volName  = "/foo"
 		volName  = "/foo"
 	)
 	)
 
 
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		volName = "C:/foo"
 		volName = "C:/foo"
 	}
 	}
 
 
@@ -4139,7 +4139,7 @@ RUN echo "  \
 
 
 	expected := "\n    foo  \n"
 	expected := "\n    foo  \n"
 	// Windows uses the builtin echo, which preserves quotes
 	// Windows uses the builtin echo, which preserves quotes
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expected = "\"    foo  \""
 		expected = "\"    foo  \""
 	}
 	}
 
 
@@ -4173,7 +4173,7 @@ func (s *DockerSuite) TestBuildMissingArgs(c *check.C) {
 		"INSERT":     {},
 		"INSERT":     {},
 	}
 	}
 
 
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		skipCmds = map[string]struct{}{
 		skipCmds = map[string]struct{}{
 			"CMD":        {},
 			"CMD":        {},
 			"RUN":        {},
 			"RUN":        {},
@@ -4306,7 +4306,7 @@ func (s *DockerSuite) TestBuildRUNErrMsg(c *check.C) {
 	name := "testbuildbadrunerrmsg"
 	name := "testbuildbadrunerrmsg"
 	shell := "/bin/sh -c"
 	shell := "/bin/sh -c"
 	exitCode := 127
 	exitCode := 127
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		shell = "cmd /S /C"
 		shell = "cmd /S /C"
 		// architectural - Windows has to start the container to determine the exe is bad, Linux does not
 		// architectural - Windows has to start the container to determine the exe is bad, Linux does not
 		exitCode = 1
 		exitCode = 1
@@ -4460,7 +4460,7 @@ func (s *DockerTrustSuite) TestTrustedBuildTagIgnoresOtherDelegationRoles(c *che
 func (s *DockerSuite) TestBuildNullStringInAddCopyVolume(c *check.C) {
 func (s *DockerSuite) TestBuildNullStringInAddCopyVolume(c *check.C) {
 	name := "testbuildnullstringinaddcopyvolume"
 	name := "testbuildnullstringinaddcopyvolume"
 	volName := "nullvolume"
 	volName := "nullvolume"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		volName = `C:\\nullvolume`
 		volName = `C:\\nullvolume`
 	}
 	}
 
 
@@ -4500,7 +4500,7 @@ func (s *DockerSuite) TestBuildBuildTimeArg(c *check.C) {
 	envKey := "foo"
 	envKey := "foo"
 	envVal := "bar"
 	envVal := "bar"
 	var dockerfile string
 	var dockerfile string
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		// Bugs in Windows busybox port - use the default base image and native cmd stuff
 		// Bugs in Windows busybox port - use the default base image and native cmd stuff
 		dockerfile = fmt.Sprintf(`FROM `+minimalBaseImage()+`
 		dockerfile = fmt.Sprintf(`FROM `+minimalBaseImage()+`
 			ARG %s
 			ARG %s
@@ -5008,7 +5008,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgDefintionWithNoEnvInjection(c *check.
 func (s *DockerSuite) TestBuildNoNamedVolume(c *check.C) {
 func (s *DockerSuite) TestBuildNoNamedVolume(c *check.C) {
 	volName := "testname:/foo"
 	volName := "testname:/foo"
 
 
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		volName = "testname:C:\\foo"
 		volName = "testname:C:\\foo"
 	}
 	}
 	dockerCmd(c, "run", "-v", volName, "busybox", "sh", "-c", "touch /foo/oops")
 	dockerCmd(c, "run", "-v", volName, "busybox", "sh", "-c", "touch /foo/oops")
@@ -5226,7 +5226,7 @@ func (s *DockerSuite) TestBuildWorkdirWindowsPath(c *check.C) {
 	testRequires(c, DaemonIsWindows)
 	testRequires(c, DaemonIsWindows)
 	name := "testbuildworkdirwindowspath"
 	name := "testbuildworkdirwindowspath"
 	buildImageSuccessfully(c, name, withDockerfile(`
 	buildImageSuccessfully(c, name, withDockerfile(`
-	FROM `+WindowsBaseImage+`
+	FROM `+testEnv.MinimalBaseImage()+`
 	RUN mkdir C:\\work
 	RUN mkdir C:\\work
 	WORKDIR C:\\work
 	WORKDIR C:\\work
 	RUN if "%CD%" NEQ "C:\work" exit -1
 	RUN if "%CD%" NEQ "C:\work" exit -1
@@ -5911,7 +5911,7 @@ func (s *DockerSuite) TestBuildOpaqueDirectory(c *check.C) {
 func (s *DockerSuite) TestBuildWindowsUser(c *check.C) {
 func (s *DockerSuite) TestBuildWindowsUser(c *check.C) {
 	testRequires(c, DaemonIsWindows)
 	testRequires(c, DaemonIsWindows)
 	name := "testbuildwindowsuser"
 	name := "testbuildwindowsuser"
-	buildImageNew(name, withDockerfile(`FROM `+WindowsBaseImage+`
+	buildImageNew(name, withDockerfile(`FROM `+testEnv.MinimalBaseImage()+`
 		RUN net user user /add
 		RUN net user user /add
 		USER user
 		USER user
 		RUN set username
 		RUN set username
@@ -5942,7 +5942,7 @@ func (s *DockerSuite) TestBuildWindowsEnvCaseInsensitive(c *check.C) {
 	testRequires(c, DaemonIsWindows)
 	testRequires(c, DaemonIsWindows)
 	name := "testbuildwindowsenvcaseinsensitive"
 	name := "testbuildwindowsenvcaseinsensitive"
 	buildImageSuccessfully(c, name, withDockerfile(`
 	buildImageSuccessfully(c, name, withDockerfile(`
-		FROM `+WindowsBaseImage+`
+		FROM `+testEnv.MinimalBaseImage()+`
 		ENV FOO=bar foo=baz
 		ENV FOO=bar foo=baz
   `))
   `))
 	res := inspectFieldJSON(c, name, "Config.Env")
 	res := inspectFieldJSON(c, name, "Config.Env")
@@ -5962,7 +5962,7 @@ WORKDIR /foo/bar
 
 
 	// The Windows busybox image has a blank `cmd`
 	// The Windows busybox image has a blank `cmd`
 	lookingFor := `["sh"]`
 	lookingFor := `["sh"]`
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		lookingFor = "null"
 		lookingFor = "null"
 	}
 	}
 	c.Assert(strings.TrimSpace(out), checker.Equals, lookingFor)
 	c.Assert(strings.TrimSpace(out), checker.Equals, lookingFor)

+ 2 - 2
integration-cli/docker_cli_by_digest_test.go

@@ -636,7 +636,7 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) {
 	// digest verification for the target layer digest.
 	// digest verification for the target layer digest.
 
 
 	// Remove distribution cache to force a re-pull of the blobs
 	// Remove distribution cache to force a re-pull of the blobs
-	if err := os.RemoveAll(filepath.Join(dockerBasePath, "image", s.d.StorageDriver(), "distribution")); err != nil {
+	if err := os.RemoveAll(filepath.Join(testEnv.DockerBasePath(), "image", s.d.StorageDriver(), "distribution")); err != nil {
 		c.Fatalf("error clearing distribution cache: %v", err)
 		c.Fatalf("error clearing distribution cache: %v", err)
 	}
 	}
 
 
@@ -679,7 +679,7 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) {
 	// digest verification for the target layer digest.
 	// digest verification for the target layer digest.
 
 
 	// Remove distribution cache to force a re-pull of the blobs
 	// Remove distribution cache to force a re-pull of the blobs
-	if err := os.RemoveAll(filepath.Join(dockerBasePath, "image", s.d.StorageDriver(), "distribution")); err != nil {
+	if err := os.RemoveAll(filepath.Join(testEnv.DockerBasePath(), "image", s.d.StorageDriver(), "distribution")); err != nil {
 		c.Fatalf("error clearing distribution cache: %v", err)
 		c.Fatalf("error clearing distribution cache: %v", err)
 	}
 	}
 
 

+ 1 - 1
integration-cli/docker_cli_cp_to_container_unix_test.go

@@ -41,7 +41,7 @@ func (s *DockerSuite) TestCpCheckDestOwnership(c *check.C) {
 }
 }
 
 
 func getRootUIDGID() (int, int, error) {
 func getRootUIDGID() (int, int, error) {
-	uidgid := strings.Split(filepath.Base(dockerBasePath), ".")
+	uidgid := strings.Split(filepath.Base(testEnv.DockerBasePath()), ".")
 	if len(uidgid) == 1 {
 	if len(uidgid) == 1 {
 		//user namespace remapping is not turned on; return 0
 		//user namespace remapping is not turned on; return 0
 		return 0, 0, nil
 		return 0, 0, nil

+ 4 - 4
integration-cli/docker_cli_create_test.go

@@ -58,7 +58,7 @@ func (s *DockerSuite) TestCreateArgs(c *check.C) {
 // Make sure we can grow the container's rootfs at creation time.
 // Make sure we can grow the container's rootfs at creation time.
 func (s *DockerSuite) TestCreateGrowRootfs(c *check.C) {
 func (s *DockerSuite) TestCreateGrowRootfs(c *check.C) {
 	// Windows and Devicemapper support growing the rootfs
 	// Windows and Devicemapper support growing the rootfs
-	if daemonPlatform != "windows" {
+	if testEnv.DaemonPlatform() != "windows" {
 		testRequires(c, Devicemapper)
 		testRequires(c, Devicemapper)
 	}
 	}
 	out, _ := dockerCmd(c, "create", "--storage-opt", "size=120G", "busybox")
 	out, _ := dockerCmd(c, "create", "--storage-opt", "size=120G", "busybox")
@@ -226,8 +226,8 @@ func (s *DockerSuite) TestCreateLabelFromImage(c *check.C) {
 func (s *DockerSuite) TestCreateHostnameWithNumber(c *check.C) {
 func (s *DockerSuite) TestCreateHostnameWithNumber(c *check.C) {
 	image := "busybox"
 	image := "busybox"
 	// Busybox on Windows does not implement hostname command
 	// Busybox on Windows does not implement hostname command
-	if daemonPlatform == "windows" {
-		image = WindowsBaseImage
+	if testEnv.DaemonPlatform() == "windows" {
+		image = testEnv.MinimalBaseImage()
 	}
 	}
 	out, _ := dockerCmd(c, "run", "-h", "web.0", image, "hostname")
 	out, _ := dockerCmd(c, "run", "-h", "web.0", image, "hostname")
 	c.Assert(strings.TrimSpace(out), checker.Equals, "web.0", check.Commentf("hostname not set, expected `web.0`, got: %s", out))
 	c.Assert(strings.TrimSpace(out), checker.Equals, "web.0", check.Commentf("hostname not set, expected `web.0`, got: %s", out))
@@ -411,7 +411,7 @@ func (s *DockerSuite) TestCreateWithWorkdir(c *check.C) {
 
 
 	dockerCmd(c, "create", "--name", name, "-w", dir, "busybox")
 	dockerCmd(c, "create", "--name", name, "-w", dir, "busybox")
 	// Windows does not create the workdir until the container is started
 	// Windows does not create the workdir until the container is started
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		dockerCmd(c, "start", name)
 		dockerCmd(c, "start", name)
 	}
 	}
 	dockerCmd(c, "cp", fmt.Sprintf("%s:%s", name, dir), prefix+slash+"tmp")
 	dockerCmd(c, "cp", fmt.Sprintf("%s:%s", name, dir), prefix+slash+"tmp")

+ 4 - 4
integration-cli/docker_cli_daemon_test.go

@@ -1398,7 +1398,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithSocketAsVolume(c *check.C) {
 // A subsequent daemon restart shoud clean up said mounts.
 // A subsequent daemon restart shoud clean up said mounts.
 func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonAndContainerKill(c *check.C) {
 func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonAndContainerKill(c *check.C) {
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 	d.StartWithBusybox(c)
 	d.StartWithBusybox(c)
 
 
@@ -1431,7 +1431,7 @@ func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonAndContainerKill(c *chec
 // os.Interrupt should perform a graceful daemon shutdown and hence cleanup mounts.
 // os.Interrupt should perform a graceful daemon shutdown and hence cleanup mounts.
 func (s *DockerDaemonSuite) TestCleanupMountsAfterGracefulShutdown(c *check.C) {
 func (s *DockerDaemonSuite) TestCleanupMountsAfterGracefulShutdown(c *check.C) {
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 	d.StartWithBusybox(c)
 	d.StartWithBusybox(c)
 
 
@@ -1652,7 +1652,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartLocalVolumes(c *check.C) {
 // FIXME(vdemeester) should be a unit test
 // FIXME(vdemeester) should be a unit test
 func (s *DockerDaemonSuite) TestDaemonCorruptedLogDriverAddress(c *check.C) {
 func (s *DockerDaemonSuite) TestDaemonCorruptedLogDriverAddress(c *check.C) {
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 	c.Assert(d.StartWithError("--log-driver=syslog", "--log-opt", "syslog-address=corrupted:42"), check.NotNil)
 	c.Assert(d.StartWithError("--log-driver=syslog", "--log-opt", "syslog-address=corrupted:42"), check.NotNil)
 	expected := "Failed to set log opts: syslog-address should be in form proto://address"
 	expected := "Failed to set log opts: syslog-address should be in form proto://address"
@@ -1662,7 +1662,7 @@ func (s *DockerDaemonSuite) TestDaemonCorruptedLogDriverAddress(c *check.C) {
 // FIXME(vdemeester) should be a unit test
 // FIXME(vdemeester) should be a unit test
 func (s *DockerDaemonSuite) TestDaemonCorruptedFluentdAddress(c *check.C) {
 func (s *DockerDaemonSuite) TestDaemonCorruptedFluentdAddress(c *check.C) {
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 	c.Assert(d.StartWithError("--log-driver=fluentd", "--log-opt", "fluentd-address=corrupted:c"), check.NotNil)
 	c.Assert(d.StartWithError("--log-driver=fluentd", "--log-opt", "fluentd-address=corrupted:c"), check.NotNil)
 	expected := "Failed to set log opts: invalid fluentd-address corrupted:c: "
 	expected := "Failed to set log opts: invalid fluentd-address corrupted:c: "

+ 1 - 1
integration-cli/docker_cli_diff_test.go

@@ -19,7 +19,7 @@ func (s *DockerSuite) TestDiffFilenameShownInOutput(c *check.C) {
 	// a "Files/" prefix.
 	// a "Files/" prefix.
 	containerID := strings.TrimSpace(out)
 	containerID := strings.TrimSpace(out)
 	lookingFor := "A /foo/bar"
 	lookingFor := "A /foo/bar"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		err := waitExited(containerID, 60*time.Second)
 		err := waitExited(containerID, 60*time.Second)
 		c.Assert(err, check.IsNil)
 		c.Assert(err, check.IsNil)
 		lookingFor = "C Files/foo/bar"
 		lookingFor = "C Files/foo/bar"

+ 1 - 1
integration-cli/docker_cli_events_test.go

@@ -688,7 +688,7 @@ func (s *DockerSuite) TestEventsContainerRestart(c *check.C) {
 
 
 	// wait until test2 is auto removed.
 	// wait until test2 is auto removed.
 	waitTime := 10 * time.Second
 	waitTime := 10 * time.Second
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		// Windows takes longer...
 		// Windows takes longer...
 		waitTime = 90 * time.Second
 		waitTime = 90 * time.Second
 	}
 	}

+ 1 - 1
integration-cli/docker_cli_external_graphdriver_unix_test.go

@@ -53,7 +53,7 @@ type graphEventsCounter struct {
 
 
 func (s *DockerExternalGraphdriverSuite) SetUpTest(c *check.C) {
 func (s *DockerExternalGraphdriverSuite) SetUpTest(c *check.C) {
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 }
 }
 
 

+ 1 - 1
integration-cli/docker_cli_external_volume_driver_unix_test.go

@@ -51,7 +51,7 @@ type DockerExternalVolumeSuite struct {
 
 
 func (s *DockerExternalVolumeSuite) SetUpTest(c *check.C) {
 func (s *DockerExternalVolumeSuite) SetUpTest(c *check.C) {
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 	s.ec = &eventCounter{}
 	s.ec = &eventCounter{}
 }
 }

+ 1 - 1
integration-cli/docker_cli_help_test.go

@@ -118,7 +118,7 @@ func (s *DockerSuite) TestHelpTextVerify(c *check.C) {
 		cmdsToTest = append(cmdsToTest, "network ls")
 		cmdsToTest = append(cmdsToTest, "network ls")
 		cmdsToTest = append(cmdsToTest, "network rm")
 		cmdsToTest = append(cmdsToTest, "network rm")
 
 
-		if experimentalDaemon {
+		if testEnv.ExperimentalDaemon() {
 			cmdsToTest = append(cmdsToTest, "checkpoint create")
 			cmdsToTest = append(cmdsToTest, "checkpoint create")
 			cmdsToTest = append(cmdsToTest, "checkpoint ls")
 			cmdsToTest = append(cmdsToTest, "checkpoint ls")
 			cmdsToTest = append(cmdsToTest, "checkpoint rm")
 			cmdsToTest = append(cmdsToTest, "checkpoint rm")

+ 7 - 7
integration-cli/docker_cli_info_test.go

@@ -36,7 +36,7 @@ func (s *DockerSuite) TestInfoEnsureSucceeds(c *check.C) {
 		"Live Restore Enabled:",
 		"Live Restore Enabled:",
 	}
 	}
 
 
-	if daemonPlatform == "linux" {
+	if testEnv.DaemonPlatform() == "linux" {
 		stringsToCheck = append(stringsToCheck, "Init Binary:", "Security Options:", "containerd version:", "runc version:", "init version:")
 		stringsToCheck = append(stringsToCheck, "Init Binary:", "Security Options:", "containerd version:", "runc version:", "init version:")
 	}
 	}
 
 
@@ -44,7 +44,7 @@ func (s *DockerSuite) TestInfoEnsureSucceeds(c *check.C) {
 		stringsToCheck = append(stringsToCheck, "Runtimes:", "Default Runtime: runc")
 		stringsToCheck = append(stringsToCheck, "Runtimes:", "Default Runtime: runc")
 	}
 	}
 
 
-	if experimentalDaemon {
+	if testEnv.ExperimentalDaemon() {
 		stringsToCheck = append(stringsToCheck, "Experimental: true")
 		stringsToCheck = append(stringsToCheck, "Experimental: true")
 	} else {
 	} else {
 		stringsToCheck = append(stringsToCheck, "Experimental: false")
 		stringsToCheck = append(stringsToCheck, "Experimental: false")
@@ -72,7 +72,7 @@ func (s *DockerSuite) TestInfoDiscoveryBackend(c *check.C) {
 	testRequires(c, SameHostDaemon, DaemonIsLinux)
 	testRequires(c, SameHostDaemon, DaemonIsLinux)
 
 
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 	discoveryBackend := "consul://consuladdr:consulport/some/path"
 	discoveryBackend := "consul://consuladdr:consulport/some/path"
 	discoveryAdvertise := "1.1.1.1:2375"
 	discoveryAdvertise := "1.1.1.1:2375"
@@ -91,7 +91,7 @@ func (s *DockerSuite) TestInfoDiscoveryInvalidAdvertise(c *check.C) {
 	testRequires(c, SameHostDaemon, DaemonIsLinux)
 	testRequires(c, SameHostDaemon, DaemonIsLinux)
 
 
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 	discoveryBackend := "consul://consuladdr:consulport/some/path"
 	discoveryBackend := "consul://consuladdr:consulport/some/path"
 
 
@@ -110,7 +110,7 @@ func (s *DockerSuite) TestInfoDiscoveryAdvertiseInterfaceName(c *check.C) {
 	testRequires(c, SameHostDaemon, Network, DaemonIsLinux)
 	testRequires(c, SameHostDaemon, Network, DaemonIsLinux)
 
 
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 	discoveryBackend := "consul://consuladdr:consulport/some/path"
 	discoveryBackend := "consul://consuladdr:consulport/some/path"
 	discoveryAdvertise := "eth0"
 	discoveryAdvertise := "eth0"
@@ -177,7 +177,7 @@ func (s *DockerSuite) TestInfoDebug(c *check.C) {
 	testRequires(c, SameHostDaemon, DaemonIsLinux)
 	testRequires(c, SameHostDaemon, DaemonIsLinux)
 
 
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 	d.Start(c, "--debug")
 	d.Start(c, "--debug")
 	defer d.Stop(c)
 	defer d.Stop(c)
@@ -200,7 +200,7 @@ func (s *DockerSuite) TestInsecureRegistries(c *check.C) {
 	registryHost := "insecurehost.com:5000"
 	registryHost := "insecurehost.com:5000"
 
 
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	d := daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 	d.Start(c, "--insecure-registry="+registryCIDR, "--insecure-registry="+registryHost)
 	d.Start(c, "--insecure-registry="+registryCIDR, "--insecure-registry="+registryHost)
 	defer d.Stop(c)
 	defer d.Stop(c)

+ 4 - 4
integration-cli/docker_cli_inspect_test.go

@@ -53,7 +53,7 @@ func (s *DockerSuite) TestInspectDefault(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestInspectStatus(c *check.C) {
 func (s *DockerSuite) TestInspectStatus(c *check.C) {
-	if daemonPlatform != "windows" {
+	if testEnv.DaemonPlatform() != "windows" {
 		defer unpauseAllContainers(c)
 		defer unpauseAllContainers(c)
 	}
 	}
 	out, _ := runSleepingContainer(c, "-d")
 	out, _ := runSleepingContainer(c, "-d")
@@ -64,7 +64,7 @@ func (s *DockerSuite) TestInspectStatus(c *check.C) {
 
 
 	// Windows does not support pause/unpause on Windows Server Containers.
 	// Windows does not support pause/unpause on Windows Server Containers.
 	// (RS1 does for Hyper-V Containers, but production CI is not setup for that)
 	// (RS1 does for Hyper-V Containers, but production CI is not setup for that)
-	if daemonPlatform != "windows" {
+	if testEnv.DaemonPlatform() != "windows" {
 		dockerCmd(c, "pause", out)
 		dockerCmd(c, "pause", out)
 		inspectOut = inspectField(c, out, "State.Status")
 		inspectOut = inspectField(c, out, "State.Status")
 		c.Assert(inspectOut, checker.Equals, "paused")
 		c.Assert(inspectOut, checker.Equals, "paused")
@@ -209,7 +209,7 @@ func (s *DockerSuite) TestInspectContainerGraphDriver(c *check.C) {
 func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) {
 func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) {
 	modifier := ",z"
 	modifier := ",z"
 	prefix, slash := getPrefixAndSlashFromDaemonPlatform()
 	prefix, slash := getPrefixAndSlashFromDaemonPlatform()
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		modifier = ""
 		modifier = ""
 		// Linux creates the host directory if it doesn't exist. Windows does not.
 		// Linux creates the host directory if it doesn't exist. Windows does not.
 		os.Mkdir(`c:\data`, os.ModeDir)
 		os.Mkdir(`c:\data`, os.ModeDir)
@@ -232,7 +232,7 @@ func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) {
 	c.Assert(m.Driver, checker.Equals, "")
 	c.Assert(m.Driver, checker.Equals, "")
 	c.Assert(m.Source, checker.Equals, prefix+slash+"data")
 	c.Assert(m.Source, checker.Equals, prefix+slash+"data")
 	c.Assert(m.Destination, checker.Equals, prefix+slash+"data")
 	c.Assert(m.Destination, checker.Equals, prefix+slash+"data")
-	if daemonPlatform != "windows" { // Windows does not set mode
+	if testEnv.DaemonPlatform() != "windows" { // Windows does not set mode
 		c.Assert(m.Mode, checker.Equals, "ro"+modifier)
 		c.Assert(m.Mode, checker.Equals, "ro"+modifier)
 	}
 	}
 	c.Assert(m.RW, checker.Equals, false)
 	c.Assert(m.RW, checker.Equals, false)

+ 1 - 1
integration-cli/docker_cli_network_unix_test.go

@@ -49,7 +49,7 @@ type DockerNetworkSuite struct {
 
 
 func (s *DockerNetworkSuite) SetUpTest(c *check.C) {
 func (s *DockerNetworkSuite) SetUpTest(c *check.C) {
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 }
 }
 
 

+ 1 - 1
integration-cli/docker_cli_plugins_test.go

@@ -47,7 +47,7 @@ func (s *DockerSuite) TestPluginBasicOps(c *check.C) {
 	c.Assert(err, checker.IsNil)
 	c.Assert(err, checker.IsNil)
 	c.Assert(out, checker.Contains, pNameWithTag)
 	c.Assert(out, checker.Contains, pNameWithTag)
 
 
-	_, err = os.Stat(filepath.Join(dockerBasePath, "plugins", id))
+	_, err = os.Stat(filepath.Join(testEnv.DockerBasePath(), "plugins", id))
 	if !os.IsNotExist(err) {
 	if !os.IsNotExist(err) {
 		c.Fatal(err)
 		c.Fatal(err)
 	}
 	}

+ 1 - 1
integration-cli/docker_cli_ps_test.go

@@ -213,7 +213,7 @@ func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) {
 	})
 	})
 
 
 	// Windows doesn't support pausing of containers
 	// Windows doesn't support pausing of containers
-	if daemonPlatform != "windows" {
+	if testEnv.DaemonPlatform() != "windows" {
 		// pause running container
 		// pause running container
 		out, _ = dockerCmd(c, "run", "-itd", "busybox")
 		out, _ = dockerCmd(c, "run", "-itd", "busybox")
 		pausedID := strings.TrimSpace(out)
 		pausedID := strings.TrimSpace(out)

+ 1 - 1
integration-cli/docker_cli_rename_test.go

@@ -104,7 +104,7 @@ func (s *DockerSuite) TestRenameAnonymousContainer(c *check.C) {
 	dockerCmd(c, "start", "container1")
 	dockerCmd(c, "start", "container1")
 
 
 	count := "-c"
 	count := "-c"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		count = "-n"
 		count = "-n"
 	}
 	}
 
 

+ 1 - 1
integration-cli/docker_cli_restart_test.go

@@ -253,7 +253,7 @@ func (s *DockerSuite) TestRestartContainerwithRestartPolicy(c *check.C) {
 	id1 := strings.TrimSpace(string(out1))
 	id1 := strings.TrimSpace(string(out1))
 	id2 := strings.TrimSpace(string(out2))
 	id2 := strings.TrimSpace(string(out2))
 	waitTimeout := 15 * time.Second
 	waitTimeout := 15 * time.Second
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		waitTimeout = 150 * time.Second
 		waitTimeout = 150 * time.Second
 	}
 	}
 	err := waitInspect(id1, "{{ .State.Restarting }} {{ .State.Running }}", "false false", waitTimeout)
 	err := waitInspect(id1, "{{ .State.Restarting }} {{ .State.Running }}", "false false", waitTimeout)

+ 2 - 2
integration-cli/docker_cli_rmi_test.go

@@ -67,7 +67,7 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) {
 
 
 	// Wait for it to exit as cannot commit a running container on Windows, and
 	// Wait for it to exit as cannot commit a running container on Windows, and
 	// it will take a few seconds to exit
 	// it will take a few seconds to exit
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		err := waitExited(containerID, 60*time.Second)
 		err := waitExited(containerID, 60*time.Second)
 		c.Assert(err, check.IsNil)
 		c.Assert(err, check.IsNil)
 	}
 	}
@@ -111,7 +111,7 @@ func (s *DockerSuite) TestRmiImgIDForce(c *check.C) {
 
 
 	// Wait for it to exit as cannot commit a running container on Windows, and
 	// Wait for it to exit as cannot commit a running container on Windows, and
 	// it will take a few seconds to exit
 	// it will take a few seconds to exit
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		err := waitExited(containerID, 60*time.Second)
 		err := waitExited(containerID, 60*time.Second)
 		c.Assert(err, check.IsNil)
 		c.Assert(err, check.IsNil)
 	}
 	}

+ 55 - 55
integration-cli/docker_cli_run_test.go

@@ -67,10 +67,10 @@ func (s *DockerSuite) TestRunLeakyFileDescriptors(c *check.C) {
 // this will fail when Internet access is unavailable
 // this will fail when Internet access is unavailable
 func (s *DockerSuite) TestRunLookupGoogleDNS(c *check.C) {
 func (s *DockerSuite) TestRunLookupGoogleDNS(c *check.C) {
 	testRequires(c, Network, NotArm)
 	testRequires(c, Network, NotArm)
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		// nslookup isn't present in Windows busybox. Is built-in. Further,
 		// nslookup isn't present in Windows busybox. Is built-in. Further,
 		// nslookup isn't present in nanoserver. Hence just use PowerShell...
 		// nslookup isn't present in nanoserver. Hence just use PowerShell...
-		dockerCmd(c, "run", WindowsBaseImage, "powershell", "Resolve-DNSName", "google.com")
+		dockerCmd(c, "run", testEnv.MinimalBaseImage(), "powershell", "Resolve-DNSName", "google.com")
 	} else {
 	} else {
 		dockerCmd(c, "run", "busybox", "nslookup", "google.com")
 		dockerCmd(c, "run", "busybox", "nslookup", "google.com")
 	}
 	}
@@ -132,7 +132,7 @@ func (s *DockerSuite) TestRunDetachedContainerIDPrinting(c *check.C) {
 func (s *DockerSuite) TestRunWorkingDirectory(c *check.C) {
 func (s *DockerSuite) TestRunWorkingDirectory(c *check.C) {
 	dir := "/root"
 	dir := "/root"
 	image := "busybox"
 	image := "busybox"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		dir = `C:/Windows`
 		dir = `C:/Windows`
 	}
 	}
 
 
@@ -155,9 +155,9 @@ func (s *DockerSuite) TestRunWorkingDirectory(c *check.C) {
 func (s *DockerSuite) TestRunWithoutNetworking(c *check.C) {
 func (s *DockerSuite) TestRunWithoutNetworking(c *check.C) {
 	count := "-c"
 	count := "-c"
 	image := "busybox"
 	image := "busybox"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		count = "-n"
 		count = "-n"
-		image = WindowsBaseImage
+		image = testEnv.MinimalBaseImage()
 	}
 	}
 
 
 	// First using the long form --net
 	// First using the long form --net
@@ -349,8 +349,8 @@ func (s *DockerSuite) TestRunWithVolumesFromExited(c *check.C) {
 	)
 	)
 
 
 	// Create a file in a volume
 	// Create a file in a volume
-	if daemonPlatform == "windows" {
-		out, exitCode = dockerCmd(c, "run", "--name", "test-data", "--volume", `c:\some\dir`, WindowsBaseImage, "cmd", "/c", `echo hello > c:\some\dir\file`)
+	if testEnv.DaemonPlatform() == "windows" {
+		out, exitCode = dockerCmd(c, "run", "--name", "test-data", "--volume", `c:\some\dir`, testEnv.MinimalBaseImage(), "cmd", "/c", `echo hello > c:\some\dir\file`)
 	} else {
 	} else {
 		out, exitCode = dockerCmd(c, "run", "--name", "test-data", "--volume", "/some/dir", "busybox", "touch", "/some/dir/file")
 		out, exitCode = dockerCmd(c, "run", "--name", "test-data", "--volume", "/some/dir", "busybox", "touch", "/some/dir/file")
 	}
 	}
@@ -359,8 +359,8 @@ func (s *DockerSuite) TestRunWithVolumesFromExited(c *check.C) {
 	}
 	}
 
 
 	// Read the file from another container using --volumes-from to access the volume in the second container
 	// Read the file from another container using --volumes-from to access the volume in the second container
-	if daemonPlatform == "windows" {
-		out, exitCode = dockerCmd(c, "run", "--volumes-from", "test-data", WindowsBaseImage, "cmd", "/c", `type c:\some\dir\file`)
+	if testEnv.DaemonPlatform() == "windows" {
+		out, exitCode = dockerCmd(c, "run", "--volumes-from", "test-data", testEnv.MinimalBaseImage(), "cmd", "/c", `type c:\some\dir\file`)
 	} else {
 	} else {
 		out, exitCode = dockerCmd(c, "run", "--volumes-from", "test-data", "busybox", "cat", "/some/dir/file")
 		out, exitCode = dockerCmd(c, "run", "--volumes-from", "test-data", "busybox", "cat", "/some/dir/file")
 	}
 	}
@@ -391,7 +391,7 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir(c *check.C) {
 	// In the case of Windows to Windows CI, if the machine is setup so that
 	// In the case of Windows to Windows CI, if the machine is setup so that
 	// the temp directory is not the C: drive, this test is invalid and will
 	// the temp directory is not the C: drive, this test is invalid and will
 	// not work.
 	// not work.
-	if daemonPlatform == "windows" && strings.ToLower(dir[:1]) != "c" {
+	if testEnv.DaemonPlatform() == "windows" && strings.ToLower(dir[:1]) != "c" {
 		c.Skip("Requires TEMP to point to C: drive")
 		c.Skip("Requires TEMP to point to C: drive")
 	}
 	}
 
 
@@ -401,8 +401,8 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir(c *check.C) {
 	}
 	}
 	f.Close()
 	f.Close()
 
 
-	if daemonPlatform == "windows" {
-		dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir %s\nRUN mklink /D c:\\test %s", WindowsBaseImage, dir, dir)
+	if testEnv.DaemonPlatform() == "windows" {
+		dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir %s\nRUN mklink /D c:\\test %s", testEnv.MinimalBaseImage(), dir, dir)
 		containerPath = `c:\test\test`
 		containerPath = `c:\test\test`
 		cmd = "tasklist"
 		cmd = "tasklist"
 	} else {
 	} else {
@@ -429,8 +429,8 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir2(c *check.C) {
 	testRequires(c, SameHostDaemon, DaemonIsLinux)
 	testRequires(c, SameHostDaemon, DaemonIsLinux)
 	name := "test-volume-symlink2"
 	name := "test-volume-symlink2"
 
 
-	if daemonPlatform == "windows" {
-		dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir c:\\%s\nRUN mklink /D c:\\test c:\\%s", WindowsBaseImage, name, name)
+	if testEnv.DaemonPlatform() == "windows" {
+		dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir c:\\%s\nRUN mklink /D c:\\test c:\\%s", testEnv.MinimalBaseImage(), name, name)
 		containerPath = `c:\test\test`
 		containerPath = `c:\test\test`
 		cmd = "tasklist"
 		cmd = "tasklist"
 	} else {
 	} else {
@@ -456,7 +456,7 @@ func (s *DockerSuite) TestRunVolumesFromInReadonlyModeFails(c *check.C) {
 		volumeDir string
 		volumeDir string
 		fileInVol string
 		fileInVol string
 	)
 	)
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		volumeDir = `c:/test` // Forward-slash as using busybox
 		volumeDir = `c:/test` // Forward-slash as using busybox
 		fileInVol = `c:/test/file`
 		fileInVol = `c:/test/file`
 	} else {
 	} else {
@@ -477,7 +477,7 @@ func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *check.C) {
 		volumeDir string
 		volumeDir string
 		fileInVol string
 		fileInVol string
 	)
 	)
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		volumeDir = `c:/test` // Forward-slash as using busybox
 		volumeDir = `c:/test` // Forward-slash as using busybox
 		fileInVol = `c:/test/file`
 		fileInVol = `c:/test/file`
 	} else {
 	} else {
@@ -498,7 +498,7 @@ func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *check.C) {
 func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) {
 func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) {
 	testRequires(c, SameHostDaemon)
 	testRequires(c, SameHostDaemon)
 	prefix, slash := getPrefixAndSlashFromDaemonPlatform()
 	prefix, slash := getPrefixAndSlashFromDaemonPlatform()
-	hostpath := testutil.RandomTmpDirPath("test", daemonPlatform)
+	hostpath := testutil.RandomTmpDirPath("test", testEnv.DaemonPlatform())
 	if err := os.MkdirAll(hostpath, 0755); err != nil {
 	if err := os.MkdirAll(hostpath, 0755); err != nil {
 		c.Fatalf("Failed to create %s: %q", hostpath, err)
 		c.Fatalf("Failed to create %s: %q", hostpath, err)
 	}
 	}
@@ -521,11 +521,11 @@ func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) {
 
 
 // Test for GH#10618
 // Test for GH#10618
 func (s *DockerSuite) TestRunNoDupVolumes(c *check.C) {
 func (s *DockerSuite) TestRunNoDupVolumes(c *check.C) {
-	path1 := testutil.RandomTmpDirPath("test1", daemonPlatform)
-	path2 := testutil.RandomTmpDirPath("test2", daemonPlatform)
+	path1 := testutil.RandomTmpDirPath("test1", testEnv.DaemonPlatform())
+	path2 := testutil.RandomTmpDirPath("test2", testEnv.DaemonPlatform())
 
 
 	someplace := ":/someplace"
 	someplace := ":/someplace"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		// Windows requires that the source directory exists before calling HCS
 		// Windows requires that the source directory exists before calling HCS
 		testRequires(c, SameHostDaemon)
 		testRequires(c, SameHostDaemon)
 		someplace = `:c:\someplace`
 		someplace = `:c:\someplace`
@@ -574,7 +574,7 @@ func (s *DockerSuite) TestRunNoDupVolumes(c *check.C) {
 // Test for #1351
 // Test for #1351
 func (s *DockerSuite) TestRunApplyVolumesFromBeforeVolumes(c *check.C) {
 func (s *DockerSuite) TestRunApplyVolumesFromBeforeVolumes(c *check.C) {
 	prefix := ""
 	prefix := ""
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		prefix = `c:`
 		prefix = `c:`
 	}
 	}
 	dockerCmd(c, "run", "--name", "parent", "-v", prefix+"/test", "busybox", "touch", prefix+"/test/foo")
 	dockerCmd(c, "run", "--name", "parent", "-v", prefix+"/test", "busybox", "touch", prefix+"/test/foo")
@@ -583,7 +583,7 @@ func (s *DockerSuite) TestRunApplyVolumesFromBeforeVolumes(c *check.C) {
 
 
 func (s *DockerSuite) TestRunMultipleVolumesFrom(c *check.C) {
 func (s *DockerSuite) TestRunMultipleVolumesFrom(c *check.C) {
 	prefix := ""
 	prefix := ""
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		prefix = `c:`
 		prefix = `c:`
 	}
 	}
 	dockerCmd(c, "run", "--name", "parent1", "-v", prefix+"/test", "busybox", "touch", prefix+"/test/foo")
 	dockerCmd(c, "run", "--name", "parent1", "-v", prefix+"/test", "busybox", "touch", prefix+"/test/foo")
@@ -613,7 +613,7 @@ func (s *DockerSuite) TestRunVerifyContainerID(c *check.C) {
 // Test that creating a container with a volume doesn't crash. Regression test for #995.
 // Test that creating a container with a volume doesn't crash. Regression test for #995.
 func (s *DockerSuite) TestRunCreateVolume(c *check.C) {
 func (s *DockerSuite) TestRunCreateVolume(c *check.C) {
 	prefix := ""
 	prefix := ""
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		prefix = `c:`
 		prefix = `c:`
 	}
 	}
 	dockerCmd(c, "run", "-v", prefix+"/var/lib/data", "busybox", "true")
 	dockerCmd(c, "run", "-v", prefix+"/var/lib/data", "busybox", "true")
@@ -669,9 +669,9 @@ func (s *DockerSuite) TestRunVolumesFromSymlinkPath(c *check.C) {
 		RUN ln -s home /foo
 		RUN ln -s home /foo
 		VOLUME ["/foo/bar"]`
 		VOLUME ["/foo/bar"]`
 
 
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		prefix = `c:`
 		prefix = `c:`
-		dfContents = `FROM ` + WindowsBaseImage + `
+		dfContents = `FROM ` + testEnv.MinimalBaseImage() + `
 	    RUN mkdir c:\home
 	    RUN mkdir c:\home
 		RUN mklink /D c:\foo c:\home
 		RUN mklink /D c:\foo c:\home
 		VOLUME ["c:/foo/bar"]
 		VOLUME ["c:/foo/bar"]
@@ -715,7 +715,7 @@ func (s *DockerSuite) TestRunExitCode(c *check.C) {
 
 
 func (s *DockerSuite) TestRunUserDefaults(c *check.C) {
 func (s *DockerSuite) TestRunUserDefaults(c *check.C) {
 	expected := "uid=0(root) gid=0(root)"
 	expected := "uid=0(root) gid=0(root)"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expected = "uid=1000(ContainerAdministrator) gid=1000(ContainerAdministrator)"
 		expected = "uid=1000(ContainerAdministrator) gid=1000(ContainerAdministrator)"
 	}
 	}
 	out, _ := dockerCmd(c, "run", "busybox", "id")
 	out, _ := dockerCmd(c, "run", "busybox", "id")
@@ -921,9 +921,9 @@ func (s *DockerSuite) TestRunEnvironmentOverride(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestRunContainerNetwork(c *check.C) {
 func (s *DockerSuite) TestRunContainerNetwork(c *check.C) {
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		// Windows busybox does not have ping. Use built in ping instead.
 		// Windows busybox does not have ping. Use built in ping instead.
-		dockerCmd(c, "run", WindowsBaseImage, "ping", "-n", "1", "127.0.0.1")
+		dockerCmd(c, "run", testEnv.MinimalBaseImage(), "ping", "-n", "1", "127.0.0.1")
 	} else {
 	} else {
 		dockerCmd(c, "run", "busybox", "ping", "-c", "1", "127.0.0.1")
 		dockerCmd(c, "run", "busybox", "ping", "-c", "1", "127.0.0.1")
 	}
 	}
@@ -1221,7 +1221,7 @@ func (s *DockerSuite) TestRunModeHostname(c *check.C) {
 func (s *DockerSuite) TestRunRootWorkdir(c *check.C) {
 func (s *DockerSuite) TestRunRootWorkdir(c *check.C) {
 	out, _ := dockerCmd(c, "run", "--workdir", "/", "busybox", "pwd")
 	out, _ := dockerCmd(c, "run", "--workdir", "/", "busybox", "pwd")
 	expected := "/\n"
 	expected := "/\n"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expected = "C:" + expected
 		expected = "C:" + expected
 	}
 	}
 	if out != expected {
 	if out != expected {
@@ -1230,9 +1230,9 @@ func (s *DockerSuite) TestRunRootWorkdir(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestRunAllowBindMountingRoot(c *check.C) {
 func (s *DockerSuite) TestRunAllowBindMountingRoot(c *check.C) {
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		// Windows busybox will fail with Permission Denied on items such as pagefile.sys
 		// Windows busybox will fail with Permission Denied on items such as pagefile.sys
-		dockerCmd(c, "run", "-v", `c:\:c:\host`, WindowsBaseImage, "cmd", "-c", "dir", `c:\host`)
+		dockerCmd(c, "run", "-v", `c:\:c:\host`, testEnv.MinimalBaseImage(), "cmd", "-c", "dir", `c:\host`)
 	} else {
 	} else {
 		dockerCmd(c, "run", "-v", "/:/host", "busybox", "ls", "/host")
 		dockerCmd(c, "run", "-v", "/:/host", "busybox", "ls", "/host")
 	}
 	}
@@ -1241,7 +1241,7 @@ func (s *DockerSuite) TestRunAllowBindMountingRoot(c *check.C) {
 func (s *DockerSuite) TestRunDisallowBindMountingRootToRoot(c *check.C) {
 func (s *DockerSuite) TestRunDisallowBindMountingRootToRoot(c *check.C) {
 	mount := "/:/"
 	mount := "/:/"
 	targetDir := "/host"
 	targetDir := "/host"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		mount = `c:\:c\`
 		mount = `c:\:c\`
 		targetDir = "c:/host" // Forward slash as using busybox
 		targetDir = "c:/host" // Forward slash as using busybox
 	}
 	}
@@ -1753,15 +1753,15 @@ func (s *DockerSuite) TestRunCleanupCmdOnEntrypoint(c *check.C) {
 	}
 	}
 	out = strings.TrimSpace(out)
 	out = strings.TrimSpace(out)
 	expected := "root"
 	expected := "root"
-	if daemonPlatform == "windows" {
-		if strings.Contains(WindowsBaseImage, "windowsservercore") {
+	if testEnv.DaemonPlatform() == "windows" {
+		if strings.Contains(testEnv.MinimalBaseImage(), "windowsservercore") {
 			expected = `user manager\containeradministrator`
 			expected = `user manager\containeradministrator`
 		} else {
 		} else {
 			expected = `ContainerAdministrator` // nanoserver
 			expected = `ContainerAdministrator` // nanoserver
 		}
 		}
 	}
 	}
 	if out != expected {
 	if out != expected {
-		c.Fatalf("Expected output %s, got %q. %s", expected, out, WindowsBaseImage)
+		c.Fatalf("Expected output %s, got %q. %s", expected, out, testEnv.MinimalBaseImage())
 	}
 	}
 }
 }
 
 
@@ -1769,7 +1769,7 @@ func (s *DockerSuite) TestRunCleanupCmdOnEntrypoint(c *check.C) {
 func (s *DockerSuite) TestRunWorkdirExistsAndIsFile(c *check.C) {
 func (s *DockerSuite) TestRunWorkdirExistsAndIsFile(c *check.C) {
 	existingFile := "/bin/cat"
 	existingFile := "/bin/cat"
 	expected := "not a directory"
 	expected := "not a directory"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		existingFile = `\windows\system32\ntdll.dll`
 		existingFile = `\windows\system32\ntdll.dll`
 		expected = `Cannot mkdir: \windows\system32\ntdll.dll is not a directory.`
 		expected = `Cannot mkdir: \windows\system32\ntdll.dll is not a directory.`
 	}
 	}
@@ -1785,7 +1785,7 @@ func (s *DockerSuite) TestRunExitOnStdinClose(c *check.C) {
 
 
 	meow := "/bin/cat"
 	meow := "/bin/cat"
 	delay := 60
 	delay := 60
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		meow = "cat"
 		meow = "cat"
 	}
 	}
 	runCmd := exec.Command(dockerBinary, "run", "--name", name, "-i", "busybox", meow)
 	runCmd := exec.Command(dockerBinary, "run", "--name", name, "-i", "busybox", meow)
@@ -1932,7 +1932,7 @@ func (s *DockerSuite) TestRunEntrypoint(c *check.C) {
 
 
 func (s *DockerSuite) TestRunBindMounts(c *check.C) {
 func (s *DockerSuite) TestRunBindMounts(c *check.C) {
 	testRequires(c, SameHostDaemon)
 	testRequires(c, SameHostDaemon)
-	if daemonPlatform == "linux" {
+	if testEnv.DaemonPlatform() == "linux" {
 		testRequires(c, DaemonIsLinux, NotUserNamespace)
 		testRequires(c, DaemonIsLinux, NotUserNamespace)
 	}
 	}
 
 
@@ -1953,7 +1953,7 @@ func (s *DockerSuite) TestRunBindMounts(c *check.C) {
 	}
 	}
 
 
 	// test writing to bind mount
 	// test writing to bind mount
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		dockerCmd(c, "run", "-v", fmt.Sprintf(`%s:c:\tmp:rw`, tmpDir), "busybox", "touch", "c:/tmp/holla")
 		dockerCmd(c, "run", "-v", fmt.Sprintf(`%s:c:\tmp:rw`, tmpDir), "busybox", "touch", "c:/tmp/holla")
 	} else {
 	} else {
 		dockerCmd(c, "run", "-v", fmt.Sprintf("%s:/tmp:rw", tmpDir), "busybox", "touch", "/tmp/holla")
 		dockerCmd(c, "run", "-v", fmt.Sprintf("%s:/tmp:rw", tmpDir), "busybox", "touch", "/tmp/holla")
@@ -1968,7 +1968,7 @@ func (s *DockerSuite) TestRunBindMounts(c *check.C) {
 	}
 	}
 
 
 	// Windows does not (and likely never will) support mounting a single file
 	// Windows does not (and likely never will) support mounting a single file
-	if daemonPlatform != "windows" {
+	if testEnv.DaemonPlatform() != "windows" {
 		// test mount a file
 		// test mount a file
 		dockerCmd(c, "run", "-v", fmt.Sprintf("%s/holla:/tmp/holla:rw", tmpDir), "busybox", "sh", "-c", "echo -n 'yotta' > /tmp/holla")
 		dockerCmd(c, "run", "-v", fmt.Sprintf("%s/holla:/tmp/holla:rw", tmpDir), "busybox", "sh", "-c", "echo -n 'yotta' > /tmp/holla")
 		content := readFile(path.Join(tmpDir, "holla"), c) // Will fail if the file doesn't exist
 		content := readFile(path.Join(tmpDir, "holla"), c) // Will fail if the file doesn't exist
@@ -1993,9 +1993,9 @@ func (s *DockerSuite) TestRunCidFileCleanupIfEmpty(c *check.C) {
 	tmpCidFile := path.Join(tmpDir, "cid")
 	tmpCidFile := path.Join(tmpDir, "cid")
 
 
 	image := "emptyfs"
 	image := "emptyfs"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		// Windows can't support an emptyfs image. Just use the regular Windows image
 		// Windows can't support an emptyfs image. Just use the regular Windows image
-		image = WindowsBaseImage
+		image = testEnv.MinimalBaseImage()
 	}
 	}
 	out, _, err := dockerCmdWithError("run", "--cidfile", tmpCidFile, image)
 	out, _, err := dockerCmdWithError("run", "--cidfile", tmpCidFile, image)
 	if err == nil {
 	if err == nil {
@@ -2039,7 +2039,7 @@ func (s *DockerSuite) TestRunCidFileCheckIDLength(c *check.C) {
 func (s *DockerSuite) TestRunSetMacAddress(c *check.C) {
 func (s *DockerSuite) TestRunSetMacAddress(c *check.C) {
 	mac := "12:34:56:78:9a:bc"
 	mac := "12:34:56:78:9a:bc"
 	var out string
 	var out string
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		out, _ = dockerCmd(c, "run", "-i", "--rm", fmt.Sprintf("--mac-address=%s", mac), "busybox", "sh", "-c", "ipconfig /all | grep 'Physical Address' | awk '{print $12}'")
 		out, _ = dockerCmd(c, "run", "-i", "--rm", fmt.Sprintf("--mac-address=%s", mac), "busybox", "sh", "-c", "ipconfig /all | grep 'Physical Address' | awk '{print $12}'")
 		mac = strings.Replace(strings.ToUpper(mac), ":", "-", -1) // To Windows-style MACs
 		mac = strings.Replace(strings.ToUpper(mac), ":", "-", -1) // To Windows-style MACs
 	} else {
 	} else {
@@ -2243,7 +2243,7 @@ func (s *DockerSuite) TestVolumesNoCopyData(c *check.C) {
 		c.Fatalf("Data was copied on volumes-from but shouldn't be:\n%q", out)
 		c.Fatalf("Data was copied on volumes-from but shouldn't be:\n%q", out)
 	}
 	}
 
 
-	tmpDir := testutil.RandomTmpDirPath("docker_test_bind_mount_copy_data", daemonPlatform)
+	tmpDir := testutil.RandomTmpDirPath("docker_test_bind_mount_copy_data", testEnv.DaemonPlatform())
 	if out, _, err := dockerCmdWithError("run", "-v", tmpDir+":/foo", "dataimage", "ls", "-lh", "/foo/bar"); err == nil || !strings.Contains(out, "No such file or directory") {
 	if out, _, err := dockerCmdWithError("run", "-v", tmpDir+":/foo", "dataimage", "ls", "-lh", "/foo/bar"); err == nil || !strings.Contains(out, "No such file or directory") {
 		c.Fatalf("Data was copied on bind-mount but shouldn't be:\n%q", out)
 		c.Fatalf("Data was copied on bind-mount but shouldn't be:\n%q", out)
 	}
 	}
@@ -2281,7 +2281,7 @@ func (s *DockerSuite) TestRunVolumesCleanPaths(c *check.C) {
 
 
 	out, err = inspectMountSourceField("dark_helmet", prefix+slash+`foo`)
 	out, err = inspectMountSourceField("dark_helmet", prefix+slash+`foo`)
 	c.Assert(err, check.IsNil)
 	c.Assert(err, check.IsNil)
-	if !strings.Contains(strings.ToLower(out), strings.ToLower(volumesConfigPath)) {
+	if !strings.Contains(strings.ToLower(out), strings.ToLower(testEnv.VolumesConfigPath())) {
 		c.Fatalf("Volume was not defined for %s/foo\n%q", prefix, out)
 		c.Fatalf("Volume was not defined for %s/foo\n%q", prefix, out)
 	}
 	}
 
 
@@ -2292,7 +2292,7 @@ func (s *DockerSuite) TestRunVolumesCleanPaths(c *check.C) {
 
 
 	out, err = inspectMountSourceField("dark_helmet", prefix+slash+"bar")
 	out, err = inspectMountSourceField("dark_helmet", prefix+slash+"bar")
 	c.Assert(err, check.IsNil)
 	c.Assert(err, check.IsNil)
-	if !strings.Contains(strings.ToLower(out), strings.ToLower(volumesConfigPath)) {
+	if !strings.Contains(strings.ToLower(out), strings.ToLower(testEnv.VolumesConfigPath())) {
 		c.Fatalf("Volume was not defined for %s/bar\n%q", prefix, out)
 		c.Fatalf("Volume was not defined for %s/bar\n%q", prefix, out)
 	}
 	}
 }
 }
@@ -2662,10 +2662,10 @@ func (s *DockerSuite) TestRunNonLocalMacAddress(c *check.C) {
 	args := []string{"run", "--mac-address", addr}
 	args := []string{"run", "--mac-address", addr}
 	expected := addr
 	expected := addr
 
 
-	if daemonPlatform != "windows" {
+	if testEnv.DaemonPlatform() != "windows" {
 		args = append(args, "busybox", "ifconfig")
 		args = append(args, "busybox", "ifconfig")
 	} else {
 	} else {
-		args = append(args, WindowsBaseImage, "ipconfig", "/all")
+		args = append(args, testEnv.MinimalBaseImage(), "ipconfig", "/all")
 		expected = strings.Replace(strings.ToUpper(addr), ":", "-", -1)
 		expected = strings.Replace(strings.ToUpper(addr), ":", "-", -1)
 	}
 	}
 
 
@@ -2758,7 +2758,7 @@ func (s *DockerSuite) TestRunSetDefaultRestartPolicy(c *check.C) {
 func (s *DockerSuite) TestRunRestartMaxRetries(c *check.C) {
 func (s *DockerSuite) TestRunRestartMaxRetries(c *check.C) {
 	out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "false")
 	out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "false")
 	timeout := 10 * time.Second
 	timeout := 10 * time.Second
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		timeout = 120 * time.Second
 		timeout = 120 * time.Second
 	}
 	}
 
 
@@ -3133,7 +3133,7 @@ func (s *DockerSuite) TestVolumeFromMixedRWOptions(c *check.C) {
 	dockerCmd(c, "run", "--volumes-from", "parent:ro", "--name", "test-volumes-1", "busybox", "true")
 	dockerCmd(c, "run", "--volumes-from", "parent:ro", "--name", "test-volumes-1", "busybox", "true")
 	dockerCmd(c, "run", "--volumes-from", "parent:rw", "--name", "test-volumes-2", "busybox", "true")
 	dockerCmd(c, "run", "--volumes-from", "parent:rw", "--name", "test-volumes-2", "busybox", "true")
 
 
-	if daemonPlatform != "windows" {
+	if testEnv.DaemonPlatform() != "windows" {
 		mRO, err := inspectMountPoint("test-volumes-1", prefix+slash+"test")
 		mRO, err := inspectMountPoint("test-volumes-1", prefix+slash+"test")
 		c.Assert(err, checker.IsNil, check.Commentf("failed to inspect mount point"))
 		c.Assert(err, checker.IsNil, check.Commentf("failed to inspect mount point"))
 		if mRO.RW {
 		if mRO.RW {
@@ -3607,8 +3607,8 @@ func (s *DockerSuite) TestRunLoopbackOnlyExistsWhenNetworkingDisabled(c *check.C
 
 
 // Issue #4681
 // Issue #4681
 func (s *DockerSuite) TestRunLoopbackWhenNetworkDisabled(c *check.C) {
 func (s *DockerSuite) TestRunLoopbackWhenNetworkDisabled(c *check.C) {
-	if daemonPlatform == "windows" {
-		dockerCmd(c, "run", "--net=none", WindowsBaseImage, "ping", "-n", "1", "127.0.0.1")
+	if testEnv.DaemonPlatform() == "windows" {
+		dockerCmd(c, "run", "--net=none", testEnv.MinimalBaseImage(), "ping", "-n", "1", "127.0.0.1")
 	} else {
 	} else {
 		dockerCmd(c, "run", "--net=none", "busybox", "ping", "-c", "1", "127.0.0.1")
 		dockerCmd(c, "run", "--net=none", "busybox", "ping", "-c", "1", "127.0.0.1")
 	}
 	}
@@ -3874,7 +3874,7 @@ func (s *DockerSuite) TestRunNonExistingCmd(c *check.C) {
 // as that's when the check is made (and yes, by its design...)
 // as that's when the check is made (and yes, by its design...)
 func (s *DockerSuite) TestCmdCannotBeInvoked(c *check.C) {
 func (s *DockerSuite) TestCmdCannotBeInvoked(c *check.C) {
 	expected := 126
 	expected := 126
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		expected = 127
 		expected = 127
 	}
 	}
 	name := "testCmdCannotBeInvoked"
 	name := "testCmdCannotBeInvoked"
@@ -4311,7 +4311,7 @@ func (s *DockerSuite) TestRunCredentialSpecFailures(c *check.C) {
 func (s *DockerSuite) TestRunCredentialSpecWellFormed(c *check.C) {
 func (s *DockerSuite) TestRunCredentialSpecWellFormed(c *check.C) {
 	testRequires(c, DaemonIsWindows, SameHostDaemon)
 	testRequires(c, DaemonIsWindows, SameHostDaemon)
 	validCS := readFile(`fixtures\credentialspecs\valid.json`, c)
 	validCS := readFile(`fixtures\credentialspecs\valid.json`, c)
-	writeFile(filepath.Join(dockerBasePath, `credentialspecs\valid.json`), validCS, c)
+	writeFile(filepath.Join(testEnv.DockerBasePath(), `credentialspecs\valid.json`), validCS, c)
 	dockerCmd(c, "run", `--security-opt=credentialspec=file://valid.json`, "busybox", "true")
 	dockerCmd(c, "run", `--security-opt=credentialspec=file://valid.json`, "busybox", "true")
 }
 }
 
 
@@ -4321,7 +4321,7 @@ func (s *DockerSuite) TestRunCredentialSpecWellFormed(c *check.C) {
 func (s *DockerSuite) TestRunServicingContainer(c *check.C) {
 func (s *DockerSuite) TestRunServicingContainer(c *check.C) {
 	testRequires(c, DaemonIsWindows, SameHostDaemon)
 	testRequires(c, DaemonIsWindows, SameHostDaemon)
 
 
-	out, _ := dockerCmd(c, "run", "-d", WindowsBaseImage, "cmd", "/c", "mkdir c:\\programdata\\Microsoft\\Windows\\ContainerUpdates\\000_000_d99f45d0-ffc8-4af7-bd9c-ea6a62e035c9_200 && sc control cexecsvc 255")
+	out, _ := dockerCmd(c, "run", "-d", testEnv.MinimalBaseImage(), "cmd", "/c", "mkdir c:\\programdata\\Microsoft\\Windows\\ContainerUpdates\\000_000_d99f45d0-ffc8-4af7-bd9c-ea6a62e035c9_200 && sc control cexecsvc 255")
 	containerID := strings.TrimSpace(out)
 	containerID := strings.TrimSpace(out)
 	err := waitExited(containerID, 60*time.Second)
 	err := waitExited(containerID, 60*time.Second)
 	c.Assert(err, checker.IsNil)
 	c.Assert(err, checker.IsNil)

+ 2 - 2
integration-cli/docker_cli_top_test.go

@@ -13,7 +13,7 @@ func (s *DockerSuite) TestTopMultipleArgs(c *check.C) {
 	cleanedContainerID := strings.TrimSpace(out)
 	cleanedContainerID := strings.TrimSpace(out)
 
 
 	var expected icmd.Expected
 	var expected icmd.Expected
-	switch daemonPlatform {
+	switch testEnv.DaemonPlatform() {
 	case "windows":
 	case "windows":
 		expected = icmd.Expected{ExitCode: 1, Err: "Windows does not support arguments to top"}
 		expected = icmd.Expected{ExitCode: 1, Err: "Windows does not support arguments to top"}
 	default:
 	default:
@@ -34,7 +34,7 @@ func (s *DockerSuite) TestTopNonPrivileged(c *check.C) {
 	// Windows will list the name of the launched executable which in this case is busybox.exe, without the parameters.
 	// Windows will list the name of the launched executable which in this case is busybox.exe, without the parameters.
 	// Linux will display the command executed in the container
 	// Linux will display the command executed in the container
 	var lookingFor string
 	var lookingFor string
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		lookingFor = "busybox.exe"
 		lookingFor = "busybox.exe"
 	} else {
 	} else {
 		lookingFor = "top"
 		lookingFor = "top"

+ 1 - 1
integration-cli/docker_cli_update_test.go

@@ -11,7 +11,7 @@ import (
 func (s *DockerSuite) TestUpdateRestartPolicy(c *check.C) {
 func (s *DockerSuite) TestUpdateRestartPolicy(c *check.C) {
 	out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "sh", "-c", "sleep 1 && false")
 	out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "sh", "-c", "sleep 1 && false")
 	timeout := 60 * time.Second
 	timeout := 60 * time.Second
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		timeout = 180 * time.Second
 		timeout = 180 * time.Second
 	}
 	}
 
 

+ 4 - 4
integration-cli/docker_deprecated_api_v124_test.go

@@ -33,7 +33,7 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumeBinds(c *check.C) {
 	// TODO Windows CI: Investigate further why this fails on Windows to Windows CI.
 	// TODO Windows CI: Investigate further why this fails on Windows to Windows CI.
 	testRequires(c, DaemonIsLinux)
 	testRequires(c, DaemonIsLinux)
 	path := "/foo"
 	path := "/foo"
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		path = `c:\foo`
 		path = `c:\foo`
 	}
 	}
 	name := "testing"
 	name := "testing"
@@ -46,7 +46,7 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumeBinds(c *check.C) {
 	c.Assert(err, checker.IsNil)
 	c.Assert(err, checker.IsNil)
 	c.Assert(status, checker.Equals, http.StatusCreated)
 	c.Assert(status, checker.Equals, http.StatusCreated)
 
 
-	bindPath := testutil.RandomTmpDirPath("test", daemonPlatform)
+	bindPath := testutil.RandomTmpDirPath("test", testEnv.DaemonPlatform())
 	config = map[string]interface{}{
 	config = map[string]interface{}{
 		"Binds": []string{bindPath + ":" + path},
 		"Binds": []string{bindPath + ":" + path},
 	}
 	}
@@ -73,8 +73,8 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartDupVolumeBinds(c *check.C)
 	c.Assert(err, checker.IsNil)
 	c.Assert(err, checker.IsNil)
 	c.Assert(status, checker.Equals, http.StatusCreated)
 	c.Assert(status, checker.Equals, http.StatusCreated)
 
 
-	bindPath1 := testutil.RandomTmpDirPath("test1", daemonPlatform)
-	bindPath2 := testutil.RandomTmpDirPath("test2", daemonPlatform)
+	bindPath1 := testutil.RandomTmpDirPath("test1", testEnv.DaemonPlatform())
+	bindPath2 := testutil.RandomTmpDirPath("test2", testEnv.DaemonPlatform())
 
 
 	config = map[string]interface{}{
 	config = map[string]interface{}{
 		"Binds": []string{bindPath1 + ":/tmp", bindPath2 + ":/tmp"},
 		"Binds": []string{bindPath1 + ":/tmp", bindPath2 + ":/tmp"},

+ 1 - 1
integration-cli/docker_hub_pull_suite_test.go

@@ -41,7 +41,7 @@ func newDockerHubPullSuite() *DockerHubPullSuite {
 func (s *DockerHubPullSuite) SetUpSuite(c *check.C) {
 func (s *DockerHubPullSuite) SetUpSuite(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	testRequires(c, DaemonIsLinux)
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
 	s.d = daemon.New(c, dockerBinary, dockerdBinary, daemon.Config{
-		Experimental: experimentalDaemon,
+		Experimental: testEnv.ExperimentalDaemon(),
 	})
 	})
 	s.d.Start(c)
 	s.d.Start(c)
 }
 }

+ 5 - 5
integration-cli/docker_utils_test.go

@@ -80,7 +80,7 @@ func deleteAllNetworks(c *check.C) {
 		if n.Name == "bridge" || n.Name == "none" || n.Name == "host" {
 		if n.Name == "bridge" || n.Name == "none" || n.Name == "host" {
 			continue
 			continue
 		}
 		}
-		if daemonPlatform == "windows" && strings.ToLower(n.Name) == "nat" {
+		if testEnv.DaemonPlatform() == "windows" && strings.ToLower(n.Name) == "nat" {
 			// nat is a pre-defined network on Windows and cannot be removed
 			// nat is a pre-defined network on Windows and cannot be removed
 			continue
 			continue
 		}
 		}
@@ -290,7 +290,7 @@ func dockerCmdInDir(c *check.C, path string, args ...string) (string, int, error
 // validateArgs is a checker to ensure tests are not running commands which are
 // validateArgs is a checker to ensure tests are not running commands which are
 // not supported on platforms. Specifically on Windows this is 'busybox top'.
 // not supported on platforms. Specifically on Windows this is 'busybox top'.
 func validateArgs(args ...string) error {
 func validateArgs(args ...string) error {
-	if daemonPlatform != "windows" {
+	if testEnv.DaemonPlatform() != "windows" {
 		return nil
 		return nil
 	}
 	}
 	foundBusybox := -1
 	foundBusybox := -1
@@ -448,7 +448,7 @@ func fakeStorage(files map[string]string) (FakeStorage, error) {
 
 
 // fakeStorageWithContext returns either a local or remote (at daemon machine) file server
 // fakeStorageWithContext returns either a local or remote (at daemon machine) file server
 func fakeStorageWithContext(ctx *FakeContext) (FakeStorage, error) {
 func fakeStorageWithContext(ctx *FakeContext) (FakeStorage, error) {
-	if isLocalDaemon {
+	if testEnv.LocalDaemon() {
 		return newLocalFakeStorage(ctx)
 		return newLocalFakeStorage(ctx)
 	}
 	}
 	return newRemoteFileServer(ctx)
 	return newRemoteFileServer(ctx)
@@ -1027,7 +1027,7 @@ func readFile(src string, c *check.C) (content string) {
 }
 }
 
 
 func containerStorageFile(containerID, basename string) string {
 func containerStorageFile(containerID, basename string) string {
-	return filepath.Join(containerStoragePath, containerID, basename)
+	return filepath.Join(testEnv.ContainerStoragePath(), containerID, basename)
 }
 }
 
 
 // docker commands that use this function must be run with the '-d' switch.
 // docker commands that use this function must be run with the '-d' switch.
@@ -1068,7 +1068,7 @@ func readContainerFileWithExec(containerID, filename string) ([]byte, error) {
 
 
 // daemonTime provides the current time on the daemon host
 // daemonTime provides the current time on the daemon host
 func daemonTime(c *check.C) time.Time {
 func daemonTime(c *check.C) time.Time {
-	if isLocalDaemon {
+	if testEnv.LocalDaemon() {
 		return time.Now()
 		return time.Now()
 	}
 	}
 
 

+ 1 - 2
integration-cli/environment/environment.go

@@ -8,11 +8,10 @@ import (
 	"strconv"
 	"strconv"
 	"strings"
 	"strings"
 
 
-	"golang.org/x/net/context"
-
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/client"
+	"golang.org/x/net/context"
 )
 )
 
 
 // Execution holds informations about the test execution environment.
 // Execution holds informations about the test execution environment.

+ 2 - 2
integration-cli/fixtures_linux_daemon_test.go

@@ -50,7 +50,7 @@ func ensureSyscallTest(c *check.C) {
 
 
 	// if no match, must build in docker, which is significantly slower
 	// if no match, must build in docker, which is significantly slower
 	// (slower mostly because of the vfs graphdriver)
 	// (slower mostly because of the vfs graphdriver)
-	if daemonPlatform != runtime.GOOS {
+	if testEnv.DaemonPlatform() != runtime.GOOS {
 		ensureSyscallTestBuild(c)
 		ensureSyscallTestBuild(c)
 		return
 		return
 	}
 	}
@@ -105,7 +105,7 @@ func ensureSyscallTestBuild(c *check.C) {
 
 
 func ensureNNPTest(c *check.C) {
 func ensureNNPTest(c *check.C) {
 	protectedImages["nnp-test:latest"] = struct{}{}
 	protectedImages["nnp-test:latest"] = struct{}{}
-	if daemonPlatform != runtime.GOOS {
+	if testEnv.DaemonPlatform() != runtime.GOOS {
 		ensureNNPTestBuild(c)
 		ensureNNPTestBuild(c)
 		return
 		return
 	}
 	}

+ 1 - 1
integration-cli/fixtures_test.go

@@ -29,7 +29,7 @@ func ensureHTTPServerImage() error {
 	}
 	}
 	defer os.RemoveAll(tmp)
 	defer os.RemoveAll(tmp)
 
 
-	goos := daemonPlatform
+	goos := testEnv.DaemonPlatform()
 	if goos == "" {
 	if goos == "" {
 		goos = "linux"
 		goos = "linux"
 	}
 	}

+ 11 - 11
integration-cli/requirements_test.go

@@ -14,7 +14,7 @@ import (
 )
 )
 
 
 func PlatformIs(platform string) bool {
 func PlatformIs(platform string) bool {
-	return daemonPlatform == platform
+	return testEnv.DaemonPlatform() == platform
 }
 }
 
 
 func ArchitectureIs(arch string) bool {
 func ArchitectureIs(arch string) bool {
@@ -26,11 +26,11 @@ func ArchitectureIsNot(arch string) bool {
 }
 }
 
 
 func StorageDriverIs(storageDriver string) bool {
 func StorageDriverIs(storageDriver string) bool {
-	return strings.HasPrefix(daemonStorageDriver, storageDriver)
+	return strings.HasPrefix(testEnv.DaemonStorageDriver(), storageDriver)
 }
 }
 
 
 func StorageDriverIsNot(storageDriver string) bool {
 func StorageDriverIsNot(storageDriver string) bool {
-	return !strings.HasPrefix(daemonStorageDriver, storageDriver)
+	return !strings.HasPrefix(testEnv.DaemonStorageDriver(), storageDriver)
 }
 }
 
 
 func DaemonIsWindows() bool {
 func DaemonIsWindows() bool {
@@ -42,11 +42,11 @@ func DaemonIsLinux() bool {
 }
 }
 
 
 func ExperimentalDaemon() bool {
 func ExperimentalDaemon() bool {
-	return experimentalDaemon
+	return testEnv.ExperimentalDaemon()
 }
 }
 
 
 func NotExperimentalDaemon() bool {
 func NotExperimentalDaemon() bool {
-	return !experimentalDaemon
+	return !testEnv.ExperimentalDaemon()
 }
 }
 
 
 func IsAmd64() bool {
 func IsAmd64() bool {
@@ -70,7 +70,7 @@ func NotS390X() bool {
 }
 }
 
 
 func SameHostDaemon() bool {
 func SameHostDaemon() bool {
-	return isLocalDaemon
+	return testEnv.LocalDaemon()
 }
 }
 
 
 func UnixCli() bool {
 func UnixCli() bool {
@@ -171,21 +171,21 @@ func UserNamespaceInKernel() bool {
 }
 }
 
 
 func IsPausable() bool {
 func IsPausable() bool {
-	if daemonPlatform == "windows" {
-		return isolation == "hyperv"
+	if testEnv.DaemonPlatform() == "windows" {
+		return testEnv.Isolation() == "hyperv"
 	}
 	}
 	return true
 	return true
 }
 }
 
 
 func NotPausable() bool {
 func NotPausable() bool {
-	if daemonPlatform == "windows" {
-		return isolation == "process"
+	if testEnv.DaemonPlatform() == "windows" {
+		return testEnv.Isolation() == "process"
 	}
 	}
 	return false
 	return false
 }
 }
 
 
 func IsolationIs(expectedIsolation string) bool {
 func IsolationIs(expectedIsolation string) bool {
-	return daemonPlatform == "windows" && string(isolation) == expectedIsolation
+	return testEnv.DaemonPlatform() == "windows" && string(testEnv.Isolation()) == expectedIsolation
 }
 }
 
 
 func IsolationIsHyperv() bool {
 func IsolationIsHyperv() bool {

+ 1 - 1
integration-cli/requirements_unix_test.go

@@ -101,7 +101,7 @@ func overlay2Supported() bool {
 		return false
 		return false
 	}
 	}
 
 
-	daemonV, err := kernel.ParseRelease(daemonKernelVersion)
+	daemonV, err := kernel.ParseRelease(testEnv.DaemonKernelVersion())
 	if err != nil {
 	if err != nil {
 		return false
 		return false
 	}
 	}

+ 1 - 1
integration-cli/test_vars_test.go

@@ -4,7 +4,7 @@ package main
 // the command is for a sleeping container based on the daemon platform.
 // the command is for a sleeping container based on the daemon platform.
 // The Windows busybox image does not have a `top` command.
 // The Windows busybox image does not have a `top` command.
 func sleepCommandForDaemonPlatform() []string {
 func sleepCommandForDaemonPlatform() []string {
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		return []string{"sleep", "240"}
 		return []string{"sleep", "240"}
 	}
 	}
 	return []string{"top"}
 	return []string{"top"}

+ 3 - 2
integration-cli/utils_test.go

@@ -1,12 +1,13 @@
 package main
 package main
 
 
 import (
 import (
-	"github.com/docker/docker/pkg/testutil/cmd"
 	"os/exec"
 	"os/exec"
+
+	"github.com/docker/docker/pkg/testutil/cmd"
 )
 )
 
 
 func getPrefixAndSlashFromDaemonPlatform() (prefix, slash string) {
 func getPrefixAndSlashFromDaemonPlatform() (prefix, slash string) {
-	if daemonPlatform == "windows" {
+	if testEnv.DaemonPlatform() == "windows" {
 		return "c:", `\`
 		return "c:", `\`
 	}
 	}
 	return "", "/"
 	return "", "/"