Browse code

migrate TestAPIImagesSaveAndLoad to integration test

Signed-off-by: Aditya Mishra <mishraaditya675@gmail.com>

Aditya Mishra authored on 2025/11/19 01:35:46
Showing 1 changed files
... ...
@@ -7,35 +7,11 @@ import (
7 7
 	"testing"
8 8
 
9 9
 	"github.com/moby/moby/client"
10
-	"github.com/moby/moby/v2/integration-cli/cli"
11
-	"github.com/moby/moby/v2/integration-cli/cli/build"
12 10
 	"github.com/moby/moby/v2/internal/testutil"
13 11
 	"github.com/moby/moby/v2/internal/testutil/request"
14 12
 	"gotest.tools/v3/assert"
15 13
 )
16 14
 
17
-func (s *DockerAPISuite) TestAPIImagesSaveAndLoad(c *testing.T) {
18
-	testRequires(c, Network)
19
-	cli.BuildCmd(c, "saveandload", build.WithDockerfile("FROM busybox\nENV FOO bar"))
20
-	id := getIDByName(c, "saveandload")
21
-
22
-	ctx := testutil.GetContext(c)
23
-	res, body, err := request.Get(ctx, "/images/"+id+"/get")
24
-	assert.NilError(c, err)
25
-	defer body.Close()
26
-	assert.Equal(c, res.StatusCode, http.StatusOK)
27
-
28
-	cli.DockerCmd(c, "rmi", id)
29
-
30
-	res, loadBody, err := request.Post(ctx, "/images/load", request.RawContent(body), request.ContentType("application/x-tar"))
31
-	assert.NilError(c, err)
32
-	defer loadBody.Close()
33
-	assert.Equal(c, res.StatusCode, http.StatusOK)
34
-
35
-	inspectOut := cli.InspectCmd(c, id, cli.Format(".Id")).Combined()
36
-	assert.Equal(c, strings.TrimSpace(inspectOut), id, "load did not work properly")
37
-}
38
-
39 15
 func (s *DockerAPISuite) TestAPIImagesImportBadSrc(c *testing.T) {
40 16
 	testRequires(c, Network, testEnv.IsLocalDaemon)
41 17