Add regression tests for client debug flag.

- Add client debug info to the `docker info` command.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 9f315dd328a33b51133a41067a508a8b59166a39
Component: engine
This commit is contained in:
David Calavera
2016-02-01 18:09:25 -05:00
parent 794f697ccd
commit 46e42d4581
5 changed files with 110 additions and 1 deletions

View File

@ -2095,3 +2095,24 @@ func (s *DockerDaemonSuite) TestDaemonStartWithoutColors(c *check.C) {
newD.Stop()
c.Assert(b.String(), check.Not(checker.Contains), infoLog)
}
func (s *DockerDaemonSuite) TestDaemonDebugLog(c *check.C) {
testRequires(c, DaemonIsLinux)
newD := NewDaemon(c)
debugLog := "\x1b[37mDEBU\x1b"
p, tty, err := pty.Open()
c.Assert(err, checker.IsNil)
defer func() {
tty.Close()
p.Close()
}()
b := bytes.NewBuffer(nil)
go io.Copy(b, p)
newD.StartWithLogFile(tty, "--debug")
newD.Stop()
c.Assert(b.String(), checker.Contains, debugLog)
}

View File

@ -146,3 +146,22 @@ func (s *DockerSuite) TestInfoDisplaysStoppedContainers(c *check.C) {
c.Assert(out, checker.Contains, fmt.Sprintf(" Paused: %d\n", 0))
c.Assert(out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", 1))
}
func (s *DockerSuite) TestInfoDebug(c *check.C) {
testRequires(c, SameHostDaemon, DaemonIsLinux)
d := NewDaemon(c)
err := d.Start("--debug")
c.Assert(err, checker.IsNil)
defer d.Stop()
out, err := d.Cmd("--debug", "info")
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, "Debug mode (client): true\n")
c.Assert(out, checker.Contains, "Debug mode (server): true\n")
c.Assert(out, checker.Contains, "File Descriptors")
c.Assert(out, checker.Contains, "Goroutines")
c.Assert(out, checker.Contains, "System Time")
c.Assert(out, checker.Contains, "EventsListeners")
c.Assert(out, checker.Contains, "Docker Root Dir")
}