Browse code

Remove deprecated environment.DockerBasePath()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2018/01/15 23:28:10
Showing 6 changed files
... ...
@@ -1514,7 +1514,7 @@ func (s *DockerSuite) TestBuildContextCleanup(c *check.C) {
1514 1514
 	testRequires(c, SameHostDaemon)
1515 1515
 
1516 1516
 	name := "testbuildcontextcleanup"
1517
-	entries, err := ioutil.ReadDir(filepath.Join(testEnv.DockerBasePath(), "tmp"))
1517
+	entries, err := ioutil.ReadDir(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "tmp"))
1518 1518
 	if err != nil {
1519 1519
 		c.Fatalf("failed to list contents of tmp dir: %s", err)
1520 1520
 	}
... ...
@@ -1522,7 +1522,7 @@ func (s *DockerSuite) TestBuildContextCleanup(c *check.C) {
1522 1522
 	buildImageSuccessfully(c, name, build.WithDockerfile(`FROM `+minimalBaseImage()+`
1523 1523
         ENTRYPOINT ["/bin/echo"]`))
1524 1524
 
1525
-	entriesFinal, err := ioutil.ReadDir(filepath.Join(testEnv.DockerBasePath(), "tmp"))
1525
+	entriesFinal, err := ioutil.ReadDir(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "tmp"))
1526 1526
 	if err != nil {
1527 1527
 		c.Fatalf("failed to list contents of tmp dir: %s", err)
1528 1528
 	}
... ...
@@ -1536,7 +1536,7 @@ func (s *DockerSuite) TestBuildContextCleanupFailedBuild(c *check.C) {
1536 1536
 	testRequires(c, SameHostDaemon)
1537 1537
 
1538 1538
 	name := "testbuildcontextcleanup"
1539
-	entries, err := ioutil.ReadDir(filepath.Join(testEnv.DockerBasePath(), "tmp"))
1539
+	entries, err := ioutil.ReadDir(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "tmp"))
1540 1540
 	if err != nil {
1541 1541
 		c.Fatalf("failed to list contents of tmp dir: %s", err)
1542 1542
 	}
... ...
@@ -1546,7 +1546,7 @@ func (s *DockerSuite) TestBuildContextCleanupFailedBuild(c *check.C) {
1546 1546
 		ExitCode: 1,
1547 1547
 	})
1548 1548
 
1549
-	entriesFinal, err := ioutil.ReadDir(filepath.Join(testEnv.DockerBasePath(), "tmp"))
1549
+	entriesFinal, err := ioutil.ReadDir(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "tmp"))
1550 1550
 	if err != nil {
1551 1551
 		c.Fatalf("failed to list contents of tmp dir: %s", err)
1552 1552
 	}
... ...
@@ -635,7 +635,7 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) {
635 635
 	// digest verification for the target layer digest.
636 636
 
637 637
 	// Remove distribution cache to force a re-pull of the blobs
638
-	if err := os.RemoveAll(filepath.Join(testEnv.DockerBasePath(), "image", s.d.StorageDriver(), "distribution")); err != nil {
638
+	if err := os.RemoveAll(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "image", s.d.StorageDriver(), "distribution")); err != nil {
639 639
 		c.Fatalf("error clearing distribution cache: %v", err)
640 640
 	}
641 641
 
... ...
@@ -678,7 +678,7 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) {
678 678
 	// digest verification for the target layer digest.
679 679
 
680 680
 	// Remove distribution cache to force a re-pull of the blobs
681
-	if err := os.RemoveAll(filepath.Join(testEnv.DockerBasePath(), "image", s.d.StorageDriver(), "distribution")); err != nil {
681
+	if err := os.RemoveAll(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "image", s.d.StorageDriver(), "distribution")); err != nil {
682 682
 		c.Fatalf("error clearing distribution cache: %v", err)
683 683
 	}
684 684
 
... ...
@@ -64,7 +64,7 @@ func (s *DockerSuite) TestCpCheckDestOwnership(c *check.C) {
64 64
 }
65 65
 
66 66
 func getRootUIDGID() (int, int, error) {
67
-	uidgid := strings.Split(filepath.Base(testEnv.DockerBasePath()), ".")
67
+	uidgid := strings.Split(filepath.Base(testEnv.DaemonInfo.DockerRootDir), ".")
68 68
 	if len(uidgid) == 1 {
69 69
 		//user namespace remapping is not turned on; return 0
70 70
 		return 0, 0, nil
... ...
@@ -55,7 +55,7 @@ func (ps *DockerPluginSuite) TestPluginBasicOps(c *check.C) {
55 55
 	c.Assert(err, checker.IsNil)
56 56
 	c.Assert(out, checker.Contains, plugin)
57 57
 
58
-	_, err = os.Stat(filepath.Join(testEnv.DockerBasePath(), "plugins", id))
58
+	_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id))
59 59
 	if !os.IsNotExist(err) {
60 60
 		c.Fatal(err)
61 61
 	}
... ...
@@ -506,14 +506,14 @@ func (s *DockerSuite) TestPluginUpgrade(c *check.C) {
506 506
 	id := strings.TrimSpace(out)
507 507
 
508 508
 	// make sure "v2" does not exists
509
-	_, err = os.Stat(filepath.Join(testEnv.DockerBasePath(), "plugins", id, "rootfs", "v2"))
509
+	_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2"))
510 510
 	c.Assert(os.IsNotExist(err), checker.True, check.Commentf(out))
511 511
 
512 512
 	dockerCmd(c, "plugin", "disable", "-f", plugin)
513 513
 	dockerCmd(c, "plugin", "upgrade", "--grant-all-permissions", "--skip-remote-check", plugin, pluginV2)
514 514
 
515 515
 	// make sure "v2" file exists
516
-	_, err = os.Stat(filepath.Join(testEnv.DockerBasePath(), "plugins", id, "rootfs", "v2"))
516
+	_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2"))
517 517
 	c.Assert(err, checker.IsNil)
518 518
 
519 519
 	dockerCmd(c, "plugin", "enable", plugin)
... ...
@@ -4232,7 +4232,7 @@ func (s *DockerSuite) TestRunCredentialSpecFailures(c *check.C) {
4232 4232
 func (s *DockerSuite) TestRunCredentialSpecWellFormed(c *check.C) {
4233 4233
 	testRequires(c, DaemonIsWindows, SameHostDaemon)
4234 4234
 	validCS := readFile(`fixtures\credentialspecs\valid.json`, c)
4235
-	writeFile(filepath.Join(testEnv.DockerBasePath(), `credentialspecs\valid.json`), validCS, c)
4235
+	writeFile(filepath.Join(testEnv.DaemonInfo.DockerRootDir, `credentialspecs\valid.json`), validCS, c)
4236 4236
 	dockerCmd(c, "run", `--security-opt=credentialspec=file://valid.json`, "busybox", "true")
4237 4237
 }
4238 4238
 
... ...
@@ -49,13 +49,6 @@ func New() (*Execution, error) {
49 49
 	}, nil
50 50
 }
51 51
 
52
-// DockerBasePath is the base path of the docker folder (by default it is -/var/run/docker)
53
-// TODO: remove
54
-// Deprecated: use Execution.DaemonInfo.DockerRootDir
55
-func (e *Execution) DockerBasePath() string {
56
-	return e.DaemonInfo.DockerRootDir
57
-}
58
-
59 52
 // ExperimentalDaemon tell whether the main daemon has
60 53
 // experimental features enabled or not
61 54
 // Deprecated: use DaemonInfo.ExperimentalBuild