Fix inspect output when no log driver specified

Config options were being ignored in the inspect output when no driver
was specified.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 2f2779b6a5c8f6efcd2ba55bf7cb0db54c259726
Component: engine
This commit is contained in:
Brian Goff
2015-08-17 11:35:34 -04:00
parent 63ab074ee2
commit f403372672
2 changed files with 22 additions and 1 deletions
@@ -1,6 +1,7 @@
package main
import (
"encoding/json"
"fmt"
"os/exec"
"strconv"
@@ -8,6 +9,7 @@ import (
"time"
"github.com/docker/docker/api/types"
"github.com/docker/docker/runconfig"
"github.com/go-check/check"
)
@@ -286,3 +288,18 @@ func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) {
_, err = time.Parse(time.RFC3339Nano, created)
c.Assert(err, check.IsNil)
}
// #15633
func (s *DockerSuite) TestInspectLogConfigNoType(c *check.C) {
dockerCmd(c, "create", "--name=test", "--log-opt", "max-file=42", "busybox")
var logConfig runconfig.LogConfig
out, err := inspectFieldJSON("test", "HostConfig.LogConfig")
c.Assert(err, check.IsNil)
err = json.NewDecoder(strings.NewReader(out)).Decode(&logConfig)
c.Assert(err, check.IsNil)
c.Assert(logConfig.Type, check.Equals, "json-file")
c.Assert(logConfig.Config["max-file"], check.Equals, "42", check.Commentf("%v", logConfig))
}