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:
@ -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)
|
||||
}
|
||||
|
||||
@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user