66 "fmt"
77 "github.com/docker/docker/pkg/integration/checker"
88 "github.com/go-check/check"
9+ "strings"
910)
1011
1112/// test invalid url //////////////////////////////////////////////////////////////////////////
@@ -54,9 +55,9 @@ func (s *DockerSuite) TestLoadFromInvalidContentLengthTooLarge(c *check.C) {
5455 printTestCaseName (); defer printTestDuration (time .Now ())
5556 testRequires (c , DaemonIsLinux )
5657
57- const MAX_LENGTH = 2147483647
58+ const MAX_LENGTH = 4294967295
5859 output , exitCode , err := dockerCmdWithError ("load" , "-i" , "http://image-tarball.s3.amazonaws.com/test/public/largefile.tar" )
59- c .Assert (output , checker .Contains , fmt .Sprintf ("should be greater than zero, less than or equal to %v\n " , MAX_LENGTH ))
60+ c .Assert (output , checker .Contains , fmt .Sprintf ("should be greater than zero and less than or equal to %v\n " , MAX_LENGTH ))
6061 c .Assert (exitCode , checker .Equals , 1 )
6162 c .Assert (err , checker .NotNil )
6263}
@@ -66,9 +67,9 @@ func (s *DockerSuite) TestLoadFromInvalidContentLengthZero(c *check.C) {
6667 printTestCaseName (); defer printTestDuration (time .Now ())
6768 testRequires (c , DaemonIsLinux )
6869
69- const MAX_LENGTH = 2147483647
70+ const MAX_LENGTH = 4294967295
7071 output , exitCode , err := dockerCmdWithError ("load" , "-i" , "http://image-tarball.s3.amazonaws.com/test/public/emptyfile.tar" )
71- c .Assert (output , checker .Equals , fmt .Sprintf ("Error response from daemon: Size of image archive is 0, should be greater than zero, less than or equal to %v\n " , MAX_LENGTH ))
72+ c .Assert (output , checker .Equals , fmt .Sprintf ("Error response from daemon: The size of the image archive file is 0, should be greater than zero and less than or equal to %v\n " , MAX_LENGTH ))
7273 c .Assert (exitCode , checker .Equals , 1 )
7374 c .Assert (err , checker .NotNil )
7475}
@@ -78,7 +79,7 @@ func (s *DockerSuite) TestLoadFromInvalidContentUnrelated(c *check.C) {
7879 testRequires (c , DaemonIsLinux )
7980
8081 output , exitCode , err := dockerCmdWithError ("load" , "-i" , "http://image-tarball.s3.amazonaws.com/test/public/readme.tar" )
81- c .Assert (output , checker .Equals , "invalid argument\n " )
82+ c .Assert (output , checker .Contains , "invalid argument\n " )
8283 c .Assert (exitCode , checker .Equals , 1 )
8384 c .Assert (err , checker .NotNil )
8485}
@@ -88,7 +89,7 @@ func (s *DockerSuite) TestLoadFromInvalidUntarFail(c *check.C) {
8889 testRequires (c , DaemonIsLinux )
8990
9091 output , exitCode , err := dockerCmdWithError ("load" , "-i" , "http://image-tarball.s3.amazonaws.com/test/public/nottar.tar" )
91- c .Assert (output , checker .Equals , "Untar re-exec error: exit status 1: output: unexpected EOF\n " )
92+ c .Assert (output , checker .Contains , "Untar re-exec error: exit status 1: output: unexpected EOF\n " )
9293 c .Assert (exitCode , checker .Equals , 1 )
9394 c .Assert (err , checker .NotNil )
9495}
@@ -109,19 +110,19 @@ func (s *DockerSuite) TestLoadFromInvalidContentIncomplete(c *check.C) {
109110
110111 deleteAllImages ()
111112
112- /*
113- // load this image will be OK, but after delete this image, there is a residual image with <none> tag occur.
114- url = "http://image-tarball.s3.amazonaws.com/test/public/helloworld-no-manifest.tgz"
115- output, exitCode, err = dockerCmdWithError("load", "-i", url)
116- c.Assert(output, check.Not(checker.Contains), "has been loaded.")
117- c.Assert(exitCode, checker.Equals, 0)
118- c.Assert(err, checker.IsNil)
119113
120- images, _ = dockerCmd(c, "images", "hello-world")
121- c.Assert(images, checker.Contains, "hello-world")
114+ //// load this image will be OK, but after delete this image, there is a residual image with <none> tag occur.
115+ //url = "http://image-tarball.s3.amazonaws.com/test/public/helloworld-no-manifest.tgz"
116+ //output, exitCode, err = dockerCmdWithError("load", "-i", url)
117+ //c.Assert(output, check.Not(checker.Contains), "has been loaded.")
118+ //c.Assert(exitCode, checker.Equals, 0)
119+ //c.Assert(err, checker.IsNil)
120+ //
121+ //images, _ = dockerCmd(c, "images", "hello-world")
122+ //c.Assert(images, checker.Contains, "hello-world")
123+ //
124+ //deleteAllImages()
122125
123- deleteAllImages()
124- */
125126
126127 url = "http://image-tarball.s3.amazonaws.com/test/public/helloworld-no-layer.tgz"
127128 output , exitCode , err = dockerCmdWithError ("load" , "-i" , url )
@@ -364,3 +365,21 @@ func (s *DockerSuite) TestLoadFromPublicURLWithQuota(c *check.C) {
364365 out , _ = dockerCmd (c , "info" )
365366 c .Assert (out , checker .Contains , "Images: 2" )
366367}
368+
369+ func (s * DockerSuite ) TestLoadFromLargeImageArchiveFile (c * check.C ) {
370+ printTestCaseName (); defer printTestDuration (time .Now ())
371+ testRequires (c , DaemonIsLinux )
372+
373+ imageName := "consol/centos-xfce-vnc" ;
374+ imageUrl := "http://image-tarball.s3.amazonaws.com/test/public/consol_centos-xfce-vnc.tar" ; //1.53GB
375+
376+ output , exitCode , err := dockerCmdWithError ("load" , "-i" , imageUrl )
377+ c .Assert (output , checker .Contains , "Start to download and load the image archive, please wait...\n " )
378+ c .Assert (output , checker .Contains , "has been loaded.\n " )
379+ c .Assert (exitCode , checker .Equals , 0 )
380+ c .Assert (err , checker .IsNil )
381+
382+ images , _ := dockerCmd (c , "images" )
383+ c .Assert (images , checker .Contains , imageName )
384+ c .Assert (len (strings .Split (images , "\n " )), checker .Equals , 3 )
385+ }
0 commit comments