Jelajahi Sumber

Merge pull request #21529 from LK4D4/test_exit_early

integration-cli: exit early if daemon immedately crashed
Vincent Demeester 9 tahun lalu
induk
melakukan
6eb3835995
2 mengubah file dengan 3 tambahan dan 1 penghapusan
  1. 2 0
      integration-cli/daemon.go
  2. 1 1
      integration-cli/docker_cli_daemon_test.go

+ 2 - 0
integration-cli/daemon.go

@@ -233,6 +233,8 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
 				return fmt.Errorf("[%s] error querying daemon for root directory: %v", d.id, err)
 				return fmt.Errorf("[%s] error querying daemon for root directory: %v", d.id, err)
 			}
 			}
 			return nil
 			return nil
+		case <-d.wait:
+			return fmt.Errorf("[%s] Daemon exited during startup", d.id)
 		}
 		}
 	}
 	}
 }
 }

+ 1 - 1
integration-cli/docker_cli_daemon_test.go

@@ -563,7 +563,7 @@ func (s *DockerDaemonSuite) TestDaemonExitOnFailure(c *check.C) {
 	//attempt to start daemon with incorrect flags (we know -b and --bip conflict)
 	//attempt to start daemon with incorrect flags (we know -b and --bip conflict)
 	if err := s.d.Start("--bridge", "nosuchbridge", "--bip", "1.1.1.1"); err != nil {
 	if err := s.d.Start("--bridge", "nosuchbridge", "--bip", "1.1.1.1"); err != nil {
 		//verify we got the right error
 		//verify we got the right error
-		if !strings.Contains(err.Error(), "Daemon exited and never started") {
+		if !strings.Contains(err.Error(), "Daemon exited") {
 			c.Fatalf("Expected daemon not to start, got %v", err)
 			c.Fatalf("Expected daemon not to start, got %v", err)
 		}
 		}
 		// look in the log and make sure we got the message that daemon is shutting down
 		// look in the log and make sure we got the message that daemon is shutting down