|
@@ -2143,6 +2143,39 @@ func (s *DockerSuite) TestBuildEnv(c *check.C) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func (s *DockerSuite) TestBuildPATH(c *check.C) {
|
|
|
|
+ testRequires(c, DaemonIsLinux)
|
|
|
|
+
|
|
|
|
+ defPath := "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
|
|
+
|
|
|
|
+ fn := func(dockerfile string, exp string) {
|
|
|
|
+ _, err := buildImage("testbldpath", dockerfile, true)
|
|
|
|
+ c.Assert(err, check.IsNil)
|
|
|
|
+
|
|
|
|
+ res, err := inspectField("testbldpath", "Config.Env")
|
|
|
|
+ c.Assert(err, check.IsNil)
|
|
|
|
+
|
|
|
|
+ if res != exp {
|
|
|
|
+ c.Fatalf("Env %q, expected %q for dockerfile:%q", res, exp, dockerfile)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ tests := []struct{ dockerfile, exp string }{
|
|
|
|
+ {"FROM scratch\nMAINTAINER me", "[PATH=" + defPath + "]"},
|
|
|
|
+ {"FROM busybox\nMAINTAINER me", "[PATH=" + defPath + "]"},
|
|
|
|
+ {"FROM scratch\nENV FOO=bar", "[PATH=" + defPath + " FOO=bar]"},
|
|
|
|
+ {"FROM busybox\nENV FOO=bar", "[PATH=" + defPath + " FOO=bar]"},
|
|
|
|
+ {"FROM scratch\nENV PATH=/test", "[PATH=/test]"},
|
|
|
|
+ {"FROM busybox\nENV PATH=/test", "[PATH=/test]"},
|
|
|
|
+ {"FROM scratch\nENV PATH=''", "[PATH=]"},
|
|
|
|
+ {"FROM busybox\nENV PATH=''", "[PATH=]"},
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for _, test := range tests {
|
|
|
|
+ fn(test.dockerfile, test.exp)
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
func (s *DockerSuite) TestBuildContextCleanup(c *check.C) {
|
|
func (s *DockerSuite) TestBuildContextCleanup(c *check.C) {
|
|
testRequires(c, DaemonIsLinux)
|
|
testRequires(c, DaemonIsLinux)
|
|
testRequires(c, SameHostDaemon)
|
|
testRequires(c, SameHostDaemon)
|