Merge pull request #11453 from duglin/HideDaemonDots
Hide dots on daemon startup when loglevel != info
This commit is contained in:
commit
9d5eab1873
2 changed files with 52 additions and 3 deletions
|
@ -346,7 +346,7 @@ func (daemon *Daemon) restore() error {
|
|||
for _, v := range dir {
|
||||
id := v.Name()
|
||||
container, err := daemon.load(id)
|
||||
if !debug {
|
||||
if !debug && log.GetLevel() == log.InfoLevel {
|
||||
fmt.Print(".")
|
||||
}
|
||||
if err != nil {
|
||||
|
@ -368,7 +368,7 @@ func (daemon *Daemon) restore() error {
|
|||
|
||||
if entities := daemon.containerGraph.List("/", -1); entities != nil {
|
||||
for _, p := range entities.Paths() {
|
||||
if !debug {
|
||||
if !debug && log.GetLevel() == log.InfoLevel {
|
||||
fmt.Print(".")
|
||||
}
|
||||
|
||||
|
@ -420,7 +420,9 @@ func (daemon *Daemon) restore() error {
|
|||
}
|
||||
|
||||
if !debug {
|
||||
fmt.Println()
|
||||
if log.GetLevel() == log.InfoLevel {
|
||||
fmt.Println()
|
||||
}
|
||||
log.Infof("Loading containers: done.")
|
||||
}
|
||||
|
||||
|
|
|
@ -753,3 +753,50 @@ func TestDaemonLoggingDriverNoneLogsError(t *testing.T) {
|
|||
}
|
||||
logDone("daemon - logs not available for non-json-file drivers")
|
||||
}
|
||||
|
||||
func TestDaemonDots(t *testing.T) {
|
||||
defer deleteAllContainers()
|
||||
d := NewDaemon(t)
|
||||
if err := d.StartWithBusybox(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Now create 4 containers
|
||||
if _, err := d.Cmd("create", "busybox"); err != nil {
|
||||
t.Fatalf("Error creating container: %q", err)
|
||||
}
|
||||
if _, err := d.Cmd("create", "busybox"); err != nil {
|
||||
t.Fatalf("Error creating container: %q", err)
|
||||
}
|
||||
if _, err := d.Cmd("create", "busybox"); err != nil {
|
||||
t.Fatalf("Error creating container: %q", err)
|
||||
}
|
||||
if _, err := d.Cmd("create", "busybox"); err != nil {
|
||||
t.Fatalf("Error creating container: %q", err)
|
||||
}
|
||||
|
||||
d.Stop()
|
||||
|
||||
d.Start("--log-level=debug")
|
||||
d.Stop()
|
||||
content, _ := ioutil.ReadFile(d.logFile.Name())
|
||||
if strings.Contains(string(content), "....") {
|
||||
t.Fatalf("Debug level should not have ....\n%s", string(content))
|
||||
}
|
||||
|
||||
d.Start("--log-level=error")
|
||||
d.Stop()
|
||||
content, _ = ioutil.ReadFile(d.logFile.Name())
|
||||
if strings.Contains(string(content), "....") {
|
||||
t.Fatalf("Error level should not have ....\n%s", string(content))
|
||||
}
|
||||
|
||||
d.Start("--log-level=info")
|
||||
d.Stop()
|
||||
content, _ = ioutil.ReadFile(d.logFile.Name())
|
||||
if !strings.Contains(string(content), "....") {
|
||||
t.Fatalf("Info level should have ....\n%s", string(content))
|
||||
}
|
||||
|
||||
logDone("daemon - test dots on INFO")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue