func (s *DockerHubPullSuite) TestPullClientDisconnect(c *check.C) {
	testRequires(c, DaemonIsLinux)
	repoName := "hello-world:latest"

	pullCmd := s.MakeCmd("pull", repoName)
	stdout, err := pullCmd.StdoutPipe()
	c.Assert(err, checker.IsNil)
	err = pullCmd.Start()
	c.Assert(err, checker.IsNil)

	// Cancel as soon as we get some output.
	buf := make([]byte, 10)
	_, err = stdout.Read(buf)
	c.Assert(err, checker.IsNil)

	err = pullCmd.Process.Kill()
	c.Assert(err, checker.IsNil)

	maxAttempts := 20
	for i := 0; ; i++ {
		if _, err := s.CmdWithError("inspect", repoName); err == nil {
			break
		}
		if i >= maxAttempts {
			c.Fatal("timeout reached: image was not pulled after client disconnected")
		}
		time.Sleep(500 * time.Millisecond)
	}
}
// TestPullClientDisconnect kills the client during a pull operation and verifies that the operation
// still succesfully completes on the daemon side.
//
// Ref: docker/docker#15589
TestPullClientDisconnect kills the client during a pull operation and verifies that the operation
still succesfully completes on the daemon side.


// TestPullClientDisconnect kills the client during a pull operation and verifies that the operation // still succesfully completes on the daemon side . // // Ref : docker / docker#15589
func (s *DockerHubPullSuite) TestPullClientDisconnect(c *check.C) {
	testRequires(c, DaemonIsLinux)
	repoName := "hello-world:latest"
	pullCmd := s.MakeCmd("pull", repoName)
	stdout, err := pullCmd.StdoutPipe()
	c.Assert(err, checker.IsNil)
	err = pullCmd.Start()
	c.Assert(err, checker.IsNil)
	buf := make([]byte, 10)
	_, err = stdout.Read(buf)
	c.Assert(err, checker.IsNil)
	err = pullCmd.Process.Kill()
	c.Assert(err, checker.IsNil)
	maxAttempts := 20
	for i := 0; ; i++ {
		if _, err := s.CmdWithError("inspect", repoName); err == nil {
			break
		}
		if i >= maxAttempts {
			c.Fatal("timeout reached: image was not pulled after client disconnected")
		}
		time.Sleep(500 * time.Millisecond)
	}
}
func ( s * DockerHubPullSuite ) TestPullClientDisconnect ( c * check . C ) { testRequires ( c , DaemonIsLinux ) repoName := " " pullCmd := s . MakeCmd ( " " , repoName ) stdout , err := pullCmd . StdoutPipe ( ) c . Assert ( err , checker . IsNil ) err = pullCmd . Start ( ) c . Assert ( err , checker . IsNil ) buf := make ( [ ] byte , 10 ) _ , err = stdout . Read ( buf ) c . Assert ( err , checker . IsNil ) err = pullCmd . Process . Kill ( ) c . Assert ( err , checker . IsNil ) maxAttempts := 20 for i := 0 ; ; i ++ { if _ , err := s . CmdWithError ( " " , repoName ) ; err == nil { break } if i >= maxAttempts { c . Fatal ( " " ) } time . Sleep ( 500 * time . Millisecond ) } }
TestPullClientDisconnect kills the client during a pull operation and verifies that the operation
still succesfully completes on the daemon side.
TestPullClientDisconnect kills the client during a pull operation and verifies that the operation still succesfully completes on the daemon side .
// Cancel as soon as we get some output.