1
0
mirror of https://github.com/moby/moby.git synced 2025-07-29 07:21:35 +03:00

inherit the daemon log options when creating containers

Signed-off-by: Shijiang Wei <mountkin@gmail.com>
This commit is contained in:
Shijiang Wei
2016-03-12 20:50:37 +08:00
parent b0a5762348
commit 1790980ec6
6 changed files with 56 additions and 46 deletions

View File

@ -1748,17 +1748,21 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithContainerWithRestartPolicyAlway
}
func (s *DockerDaemonSuite) TestDaemonWideLogConfig(c *check.C) {
if err := s.d.StartWithBusybox("--log-driver=json-file", "--log-opt=max-size=1k"); err != nil {
if err := s.d.StartWithBusybox("--log-opt=max-size=1k"); err != nil {
c.Fatal(err)
}
out, err := s.d.Cmd("run", "-d", "--name=logtest", "busybox", "top")
name := "logtest"
out, err := s.d.Cmd("run", "-d", "--log-opt=max-file=5", "--name", name, "busybox", "top")
c.Assert(err, check.IsNil, check.Commentf("Output: %s, err: %v", out, err))
out, err = s.d.Cmd("inspect", "-f", "{{ .HostConfig.LogConfig.Config }}", "logtest")
out, err = s.d.Cmd("inspect", "-f", "{{ .HostConfig.LogConfig.Config }}", name)
c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
cfg := strings.TrimSpace(out)
if cfg != "map[max-size:1k]" {
c.Fatalf("Unexpected log-opt: %s, expected map[max-size:1k]", cfg)
}
c.Assert(out, checker.Contains, "max-size:1k")
c.Assert(out, checker.Contains, "max-file:5")
out, err = s.d.Cmd("inspect", "-f", "{{ .HostConfig.LogConfig.Type }}", name)
c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
c.Assert(strings.TrimSpace(out), checker.Equals, "json-file")
}
func (s *DockerDaemonSuite) TestDaemonRestartWithPausedContainer(c *check.C) {