mirror of
https://github.com/moby/moby.git
synced 2026-01-11 02:31:44 +00:00
Merge pull request #51106 from thaJeztah/rm_deprecated_utils
integration-cli: remove deprecated buildImageSuccessfully, buildImage utilities
This commit is contained in:
@@ -1588,7 +1588,7 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsCreate(c *testing.T) {
|
||||
var testImg string
|
||||
if testEnv.DaemonInfo.OSType != "windows" {
|
||||
testImg = "test-mount-config"
|
||||
buildImageSuccessfully(c, testImg, build.WithDockerfile(`
|
||||
cli.BuildCmd(c, testImg, build.WithDockerfile(`
|
||||
FROM busybox
|
||||
RUN mkdir `+destPath+` && touch `+destPath+slash+`bar
|
||||
CMD cat `+destPath+slash+`bar
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
func (s *DockerAPISuite) TestAPIImagesSaveAndLoad(c *testing.T) {
|
||||
testRequires(c, Network)
|
||||
buildImageSuccessfully(c, "saveandload", build.WithDockerfile("FROM busybox\nENV FOO bar"))
|
||||
cli.BuildCmd(c, "saveandload", build.WithDockerfile("FROM busybox\nENV FOO bar"))
|
||||
id := getIDByName(c, "saveandload")
|
||||
|
||||
ctx := testutil.GetContext(c)
|
||||
@@ -45,7 +45,7 @@ func (s *DockerAPISuite) TestAPIImagesDelete(c *testing.T) {
|
||||
testRequires(c, Network)
|
||||
}
|
||||
name := "test-api-images-delete"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile("FROM busybox\nENV FOO bar"))
|
||||
cli.BuildCmd(c, name, build.WithDockerfile("FROM busybox\nENV FOO bar"))
|
||||
id := getIDByName(c, name)
|
||||
|
||||
cli.DockerCmd(c, "tag", name, "test:tag1")
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -115,7 +115,7 @@ func (s *DockerCLIBuildSuite) TestBuildAddChangeOwnership(c *testing.T) {
|
||||
|
||||
defer ctx.Close()
|
||||
|
||||
buildImageSuccessfully(c, name, build.WithExternalBuildContext(ctx))
|
||||
cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
|
||||
}
|
||||
|
||||
// Test that an infinite sleep during a build is killed if the client disconnects.
|
||||
|
||||
@@ -175,7 +175,7 @@ func (s *DockerRegistrySuite) TestBuildByDigest(t *testing.T) {
|
||||
|
||||
// do the build
|
||||
const name = "buildbydigest"
|
||||
buildImageSuccessfully(t, name, build.WithDockerfile(fmt.Sprintf(
|
||||
cli.BuildCmd(t, name, build.WithDockerfile(fmt.Sprintf(
|
||||
`FROM %s
|
||||
CMD ["/bin/echo", "Hello World"]`, imageReference)))
|
||||
assert.NilError(t, err)
|
||||
@@ -403,7 +403,7 @@ func (s *DockerRegistrySuite) TestPsListContainersFilterAncestorImageByDigest(t
|
||||
|
||||
// build an image from it
|
||||
const imageName1 = "images_ps_filter_test"
|
||||
buildImageSuccessfully(t, imageName1, build.WithDockerfile(fmt.Sprintf(
|
||||
cli.BuildCmd(t, imageName1, build.WithDockerfile(fmt.Sprintf(
|
||||
`FROM %s
|
||||
LABEL match me 1`, imageReference)))
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ func (s *DockerCLICreateSuite) TestCreateLabels(c *testing.T) {
|
||||
|
||||
func (s *DockerCLICreateSuite) TestCreateLabelFromImage(c *testing.T) {
|
||||
imageName := "testcreatebuildlabel"
|
||||
buildImageSuccessfully(c, imageName, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, imageName, build.WithDockerfile(`FROM busybox
|
||||
LABEL k1=v1 k2=v2`))
|
||||
|
||||
const name = "test_create_labels_from_image"
|
||||
|
||||
@@ -337,7 +337,7 @@ func (s *DockerCLIEventSuite) TestEventsFilterImageLabels(c *testing.T) {
|
||||
label := "io.docker.testing=image"
|
||||
|
||||
// Build a test image.
|
||||
buildImageSuccessfully(c, name,
|
||||
cli.BuildCmd(c, name,
|
||||
build.WithDockerfile("FROM busybox:latest\nLABEL "+label),
|
||||
build.WithoutCache, // Make sure image is actually built
|
||||
)
|
||||
@@ -418,7 +418,7 @@ func (s *DockerCLIEventSuite) TestEventsCommit(c *testing.T) {
|
||||
|
||||
func (s *DockerCLIEventSuite) TestEventsCopy(c *testing.T) {
|
||||
// Build a test image.
|
||||
buildImageSuccessfully(c, "cpimg", build.WithDockerfile(`
|
||||
cli.BuildCmd(c, "cpimg", build.WithDockerfile(`
|
||||
FROM busybox
|
||||
RUN echo HI > /file`))
|
||||
id := getIDByName(c, "cpimg")
|
||||
@@ -560,7 +560,7 @@ func (s *DockerCLIEventSuite) TestEventsFilterType(c *testing.T) {
|
||||
label := "io.docker.testing=image"
|
||||
|
||||
// Build a test image.
|
||||
buildImageSuccessfully(c, name,
|
||||
cli.BuildCmd(c, name,
|
||||
build.WithDockerfile("FROM busybox:latest\nLABEL "+label),
|
||||
build.WithoutCache, // Make sure image is actually built
|
||||
)
|
||||
|
||||
@@ -312,7 +312,7 @@ func (s *DockerCLIEventSuite) TestEventsImageUntagDelete(c *testing.T) {
|
||||
defer observer.Stop()
|
||||
|
||||
name := "testimageevents"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(`FROM scratch
|
||||
cli.BuildCmd(c, name, build.WithDockerfile(`FROM scratch
|
||||
MAINTAINER "docker"`))
|
||||
imageID := getIDByName(c, name)
|
||||
assert.NilError(c, deleteImages(name))
|
||||
|
||||
@@ -491,7 +491,7 @@ func (s *DockerCLIExecSuite) TestExecWithImageUser(c *testing.T) {
|
||||
// Not applicable on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
const name = "testbuilduser"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, name, build.WithDockerfile(`FROM busybox
|
||||
RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd
|
||||
USER dockerio`))
|
||||
cli.DockerCmd(c, "run", "-d", "--name", "dockerioexec", name, "top")
|
||||
|
||||
@@ -56,7 +56,7 @@ func (s *DockerCLIHealthSuite) TestHealth(c *testing.T) {
|
||||
existingContainers := ExistingContainerIDs(c)
|
||||
|
||||
imageName := "testhealth"
|
||||
buildImageSuccessfully(c, imageName, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, imageName, build.WithDockerfile(`FROM busybox
|
||||
RUN echo OK > /status
|
||||
CMD ["/bin/sleep", "120"]
|
||||
STOPSIGNAL SIGKILL
|
||||
@@ -100,7 +100,7 @@ func (s *DockerCLIHealthSuite) TestHealth(c *testing.T) {
|
||||
cli.DockerCmd(c, "rm", "noh")
|
||||
|
||||
// Disable the check with a new build
|
||||
buildImageSuccessfully(c, "no_healthcheck", build.WithDockerfile(`FROM testhealth
|
||||
cli.BuildCmd(c, "no_healthcheck", build.WithDockerfile(`FROM testhealth
|
||||
HEALTHCHECK NONE`))
|
||||
|
||||
out = cli.DockerCmd(c, "inspect", "--format={{.Config.Healthcheck.Test}}", "no_healthcheck").Stdout()
|
||||
@@ -144,7 +144,7 @@ func (s *DockerCLIHealthSuite) TestHealth(c *testing.T) {
|
||||
cli.DockerCmd(c, "rm", "-f", "test")
|
||||
|
||||
// Check JSON-format
|
||||
buildImageSuccessfully(c, imageName, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, imageName, build.WithDockerfile(`FROM busybox
|
||||
RUN echo OK > /status
|
||||
CMD ["/bin/sleep", "120"]
|
||||
STOPSIGNAL SIGKILL
|
||||
@@ -159,7 +159,7 @@ func (s *DockerCLIHealthSuite) TestUnsetEnvVarHealthCheck(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // busybox doesn't work on Windows
|
||||
|
||||
imageName := "testhealth"
|
||||
buildImageSuccessfully(c, imageName, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, imageName, build.WithDockerfile(`FROM busybox
|
||||
HEALTHCHECK --interval=1s --timeout=5s --retries=5 CMD /bin/sh -c "sleep 1"
|
||||
ENTRYPOINT /bin/sh -c "sleep 600"`))
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ func (s *DockerCLIHistorySuite) OnTimeout(t *testing.T) {
|
||||
// sort is not predictable it doesn't always fail.
|
||||
func (s *DockerCLIHistorySuite) TestBuildHistory(c *testing.T) {
|
||||
const name = "testbuildhistory"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(`FROM `+minimalBaseImage()+`
|
||||
cli.BuildCmd(c, name, build.WithDockerfile(`FROM `+minimalBaseImage()+`
|
||||
LABEL label.A="A"
|
||||
LABEL label.B="B"
|
||||
LABEL label.C="C"
|
||||
|
||||
@@ -60,15 +60,15 @@ func (s *DockerCLIImagesSuite) TestImagesEnsureImageWithBadTagIsNotListed(c *tes
|
||||
}
|
||||
|
||||
func (s *DockerCLIImagesSuite) TestImagesOrderedByCreationDate(c *testing.T) {
|
||||
buildImageSuccessfully(c, "order:test_a", build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, "order:test_a", build.WithDockerfile(`FROM busybox
|
||||
MAINTAINER dockerio1`))
|
||||
id1 := getIDByName(c, "order:test_a")
|
||||
time.Sleep(1 * time.Second)
|
||||
buildImageSuccessfully(c, "order:test_c", build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, "order:test_c", build.WithDockerfile(`FROM busybox
|
||||
MAINTAINER dockerio2`))
|
||||
id2 := getIDByName(c, "order:test_c")
|
||||
time.Sleep(1 * time.Second)
|
||||
buildImageSuccessfully(c, "order:test_b", build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, "order:test_b", build.WithDockerfile(`FROM busybox
|
||||
MAINTAINER dockerio3`))
|
||||
id3 := getIDByName(c, "order:test_b")
|
||||
|
||||
@@ -89,15 +89,15 @@ func (s *DockerCLIImagesSuite) TestImagesFilterLabelMatch(c *testing.T) {
|
||||
const imageName1 = "images_filter_test1"
|
||||
const imageName2 = "images_filter_test2"
|
||||
const imageName3 = "images_filter_test3"
|
||||
buildImageSuccessfully(c, imageName1, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, imageName1, build.WithDockerfile(`FROM busybox
|
||||
LABEL match me`))
|
||||
image1ID := getIDByName(c, imageName1)
|
||||
|
||||
buildImageSuccessfully(c, imageName2, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, imageName2, build.WithDockerfile(`FROM busybox
|
||||
LABEL match="me too"`))
|
||||
image2ID := getIDByName(c, imageName2)
|
||||
|
||||
buildImageSuccessfully(c, imageName3, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, imageName3, build.WithDockerfile(`FROM busybox
|
||||
LABEL nomatch me`))
|
||||
image3ID := getIDByName(c, imageName3)
|
||||
|
||||
@@ -128,13 +128,13 @@ func (s *DockerCLIImagesSuite) TestCommitWithFilterLabel(c *testing.T) {
|
||||
}
|
||||
|
||||
func (s *DockerCLIImagesSuite) TestImagesFilterSinceAndBefore(c *testing.T) {
|
||||
buildImageSuccessfully(c, "image:1", build.WithDockerfile(`FROM `+minimalBaseImage()+`
|
||||
cli.BuildCmd(c, "image:1", build.WithDockerfile(`FROM `+minimalBaseImage()+`
|
||||
LABEL number=1`))
|
||||
imageID1 := getIDByName(c, "image:1")
|
||||
buildImageSuccessfully(c, "image:2", build.WithDockerfile(`FROM `+minimalBaseImage()+`
|
||||
cli.BuildCmd(c, "image:2", build.WithDockerfile(`FROM `+minimalBaseImage()+`
|
||||
LABEL number=2`))
|
||||
imageID2 := getIDByName(c, "image:2")
|
||||
buildImageSuccessfully(c, "image:3", build.WithDockerfile(`FROM `+minimalBaseImage()+`
|
||||
cli.BuildCmd(c, "image:3", build.WithDockerfile(`FROM `+minimalBaseImage()+`
|
||||
LABEL number=3`))
|
||||
imageID3 := getIDByName(c, "image:3")
|
||||
|
||||
@@ -200,7 +200,7 @@ func assertImageList(out string, expected []string) bool {
|
||||
func (s *DockerCLIImagesSuite) TestImagesFilterSpaceTrimCase(c *testing.T) {
|
||||
const imageName = "images_filter_test"
|
||||
// Build a image and fail to build so that we have dangling images ?
|
||||
buildImage(imageName, build.WithDockerfile(`FROM busybox
|
||||
cli.Docker(cli.Args("build", "-t", imageName), build.WithDockerfile(`FROM busybox
|
||||
RUN touch /test/foo
|
||||
RUN touch /test/bar
|
||||
RUN touch /test/baz`)).Assert(c, icmd.Expected{
|
||||
@@ -275,7 +275,7 @@ func (s *DockerCLIImagesSuite) TestImagesEnsureOnlyHeadsImagesShown(c *testing.T
|
||||
MAINTAINER docker
|
||||
ENV foo bar`
|
||||
const name = "scratch-image"
|
||||
result := buildImage(name, build.WithDockerfile(dockerfile))
|
||||
result := cli.Docker(cli.Args("build", "-t", name), build.WithDockerfile(dockerfile))
|
||||
result.Assert(c, icmd.Success)
|
||||
id := getIDByName(c, name)
|
||||
|
||||
@@ -299,7 +299,7 @@ func (s *DockerCLIImagesSuite) TestImagesEnsureImagesFromScratchShown(c *testing
|
||||
MAINTAINER docker`
|
||||
|
||||
const name = "scratch-image"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(dockerfile))
|
||||
cli.BuildCmd(c, name, build.WithDockerfile(dockerfile))
|
||||
id := getIDByName(c, name)
|
||||
|
||||
out := cli.DockerCmd(c, "images").Stdout()
|
||||
@@ -315,7 +315,7 @@ func (s *DockerCLIImagesSuite) TestImagesEnsureImagesFromBusyboxShown(c *testing
|
||||
MAINTAINER docker`
|
||||
const name = "busybox-image"
|
||||
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(dockerfile))
|
||||
cli.BuildCmd(c, name, build.WithDockerfile(dockerfile))
|
||||
id := getIDByName(c, name)
|
||||
|
||||
out := cli.DockerCmd(c, "images").Stdout()
|
||||
|
||||
@@ -323,17 +323,17 @@ func (s *DockerCLIPsSuite) TestPsListContainersFilterAncestorImage(c *testing.T)
|
||||
|
||||
// Build images
|
||||
imageName1 := "images_ps_filter_test1"
|
||||
buildImageSuccessfully(c, imageName1, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, imageName1, build.WithDockerfile(`FROM busybox
|
||||
LABEL match me 1`))
|
||||
imageID1 := getIDByName(c, imageName1)
|
||||
|
||||
imageName1Tagged := "images_ps_filter_test1:tag"
|
||||
buildImageSuccessfully(c, imageName1Tagged, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, imageName1Tagged, build.WithDockerfile(`FROM busybox
|
||||
LABEL match me 1 tagged`))
|
||||
imageID1Tagged := getIDByName(c, imageName1Tagged)
|
||||
|
||||
imageName2 := "images_ps_filter_test2"
|
||||
buildImageSuccessfully(c, imageName2, build.WithDockerfile(fmt.Sprintf(`FROM %s
|
||||
cli.BuildCmd(c, imageName2, build.WithDockerfile(fmt.Sprintf(`FROM %s
|
||||
LABEL match me 2`, imageName1)))
|
||||
imageID2 := getIDByName(c, imageName2)
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ func (s *DockerRegistrySuite) TestConcurrentPullWholeRepo(t *testing.T) {
|
||||
var repos []string
|
||||
for _, tag := range []string{"recent", "fresh", "todays"} {
|
||||
repo := fmt.Sprintf("%v:%v", imgRepo, tag)
|
||||
buildImageSuccessfully(t, repo, build.WithDockerfile(fmt.Sprintf(`
|
||||
cli.BuildCmd(t, repo, build.WithDockerfile(fmt.Sprintf(`
|
||||
FROM busybox
|
||||
ENTRYPOINT ["/bin/echo"]
|
||||
ENV FOO foo
|
||||
@@ -130,7 +130,7 @@ func (s *DockerRegistrySuite) TestConcurrentPullMultipleTags(t *testing.T) {
|
||||
var repos []string
|
||||
for _, tag := range []string{"recent", "fresh", "todays"} {
|
||||
repo := fmt.Sprintf("%v:%v", imgRepo, tag)
|
||||
buildImageSuccessfully(t, repo, build.WithDockerfile(fmt.Sprintf(`
|
||||
cli.BuildCmd(t, repo, build.WithDockerfile(fmt.Sprintf(`
|
||||
FROM busybox
|
||||
ENTRYPOINT ["/bin/echo"]
|
||||
ENV FOO foo
|
||||
@@ -176,7 +176,7 @@ func (s *DockerRegistrySuite) TestPullIDStability(t *testing.T) {
|
||||
const derivedImage = privateRegistryURL + "/dockercli/id-stability"
|
||||
const baseImage = "busybox"
|
||||
|
||||
buildImageSuccessfully(t, derivedImage, build.WithDockerfile(fmt.Sprintf(`
|
||||
cli.BuildCmd(t, derivedImage, build.WithDockerfile(fmt.Sprintf(`
|
||||
FROM %s
|
||||
ENV derived true
|
||||
ENV asdf true
|
||||
@@ -226,7 +226,7 @@ func (s *DockerRegistrySuite) TestPullIDStability(t *testing.T) {
|
||||
func (s *DockerRegistrySuite) TestPullNoLayers(t *testing.T) {
|
||||
const imgRepo = privateRegistryURL + "/dockercli/scratch"
|
||||
|
||||
buildImageSuccessfully(t, imgRepo, build.WithDockerfile(`
|
||||
cli.BuildCmd(t, imgRepo, build.WithDockerfile(`
|
||||
FROM scratch
|
||||
ENV foo bar`))
|
||||
cli.DockerCmd(t, "push", imgRepo)
|
||||
|
||||
@@ -135,7 +135,7 @@ func (s *DockerRegistrySuite) TestConcurrentPush(c *testing.T) {
|
||||
var repos []string
|
||||
for _, tag := range []string{"push1", "push2", "push3"} {
|
||||
repo := fmt.Sprintf("%v:%v", imgRepo, tag)
|
||||
buildImageSuccessfully(c, repo, build.WithDockerfile(fmt.Sprintf("FROM busybox\nCMD echo hello from %s\n", repo)))
|
||||
cli.BuildCmd(c, repo, build.WithDockerfile(fmt.Sprintf("FROM busybox\nCMD echo hello from %s\n", repo)))
|
||||
repos = append(repos, repo)
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ func (s *DockerCLIRmiSuite) TestRmiImgIDForce(c *testing.T) {
|
||||
// See https://github.com/moby/moby/issues/14116
|
||||
func (s *DockerCLIRmiSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c *testing.T) {
|
||||
dockerfile := "FROM busybox\nRUN echo test 14116\n"
|
||||
buildImageSuccessfully(c, "test-14116", build.WithDockerfile(dockerfile))
|
||||
cli.BuildCmd(c, "test-14116", build.WithDockerfile(dockerfile))
|
||||
imgID := getIDByName(c, "test-14116")
|
||||
|
||||
newTag := "newtag"
|
||||
@@ -212,7 +212,7 @@ func (s *DockerCLIRmiSuite) TestRmiForceWithMultipleRepositories(c *testing.T) {
|
||||
tag1 := imageName + ":tag1"
|
||||
tag2 := imageName + ":tag2"
|
||||
|
||||
buildImageSuccessfully(c, tag1, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, tag1, build.WithDockerfile(`FROM busybox
|
||||
MAINTAINER "docker"`))
|
||||
cli.DockerCmd(c, "tag", tag1, tag2)
|
||||
|
||||
@@ -240,7 +240,7 @@ func (s *DockerCLIRmiSuite) TestRmiContainerImageNotFound(c *testing.T) {
|
||||
imageIds := make([]string, 2)
|
||||
for i, name := range imageNames {
|
||||
dockerfile := fmt.Sprintf("FROM busybox\nMAINTAINER %s\nRUN echo %s\n", name, name)
|
||||
buildImageSuccessfully(c, name, build.WithoutCache, build.WithDockerfile(dockerfile))
|
||||
cli.BuildCmd(c, name, build.WithoutCache, build.WithDockerfile(dockerfile))
|
||||
id := getIDByName(c, name)
|
||||
imageIds[i] = id
|
||||
}
|
||||
@@ -269,7 +269,7 @@ RUN echo 0 #layer0
|
||||
RUN echo 1 #layer1
|
||||
RUN echo 2 #layer2
|
||||
`
|
||||
buildImageSuccessfully(c, imgName, build.WithoutCache, build.WithDockerfile(dockerfile))
|
||||
cli.BuildCmd(c, imgName, build.WithoutCache, build.WithDockerfile(dockerfile))
|
||||
out := cli.DockerCmd(c, "history", "-q", imgName).Stdout()
|
||||
ids := strings.Split(out, "\n")
|
||||
idToTag := ids[2]
|
||||
@@ -306,7 +306,7 @@ RUN echo 2 #layer2
|
||||
func (*DockerCLIRmiSuite) TestRmiParentImageFail(c *testing.T) {
|
||||
skip.If(c, testEnv.UsingSnapshotter(), "image are independent when using the containerd image store")
|
||||
|
||||
buildImageSuccessfully(c, "test", build.WithDockerfile(`
|
||||
cli.BuildCmd(c, "test", build.WithDockerfile(`
|
||||
FROM busybox
|
||||
RUN echo hello`))
|
||||
|
||||
|
||||
@@ -412,7 +412,7 @@ func (s *DockerCLIRunSuite) TestRunCreateVolumesInSymlinkDir(c *testing.T) {
|
||||
containerPath = "/test/test"
|
||||
cmd = "true"
|
||||
}
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(dockerFile))
|
||||
cli.BuildCmd(c, name, build.WithDockerfile(dockerFile))
|
||||
cli.DockerCmd(c, "run", "-v", containerPath, name, cmd)
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ func (s *DockerCLIRunSuite) TestRunCreateVolumesInSymlinkDir2(c *testing.T) {
|
||||
containerPath = "/test/test"
|
||||
cmd = "true"
|
||||
}
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(dockerFile))
|
||||
cli.BuildCmd(c, name, build.WithDockerfile(dockerFile))
|
||||
cli.DockerCmd(c, "run", "-v", containerPath, name, cmd)
|
||||
}
|
||||
|
||||
@@ -1582,7 +1582,7 @@ func (s *DockerCLIRunSuite) TestRunCopyVolumeUIDGID(c *testing.T) {
|
||||
// Not applicable on Windows as it does not support uid or gid in this way
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "testrunvolumesuidgid"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, name, build.WithDockerfile(`FROM busybox
|
||||
RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd
|
||||
RUN echo 'dockerio:x:1001:' >> /etc/group
|
||||
RUN mkdir -p /hello && touch /hello/test && chown dockerio.dockerio /hello`))
|
||||
@@ -1601,7 +1601,7 @@ func (s *DockerCLIRunSuite) TestRunCopyVolumeContent(c *testing.T) {
|
||||
// that copies from the image to the volume.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "testruncopyvolumecontent"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, name, build.WithDockerfile(`FROM busybox
|
||||
RUN mkdir -p /hello/local && echo hello > /hello/local/world`))
|
||||
|
||||
// Test that the content is copied from the image to the volume
|
||||
@@ -1613,7 +1613,7 @@ func (s *DockerCLIRunSuite) TestRunCopyVolumeContent(c *testing.T) {
|
||||
|
||||
func (s *DockerCLIRunSuite) TestRunCleanupCmdOnEntrypoint(c *testing.T) {
|
||||
name := "testrunmdcleanuponentrypoint"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, name, build.WithDockerfile(`FROM busybox
|
||||
ENTRYPOINT ["echo"]
|
||||
CMD ["testingpoint"]`))
|
||||
|
||||
@@ -2073,7 +2073,7 @@ func (s *DockerCLIRunSuite) TestVolumesNoCopyData(c *testing.T) {
|
||||
// are pre-populated such as is built in the dockerfile used in this test.
|
||||
testRequires(c, DaemonIsLinux)
|
||||
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
||||
buildImageSuccessfully(c, "dataimage", build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, "dataimage", build.WithDockerfile(`FROM busybox
|
||||
RUN ["mkdir", "-p", "/foo"]
|
||||
RUN ["touch", "/foo/bar"]`))
|
||||
cli.DockerCmd(c, "run", "--name", "test", "-v", prefix+slash+"foo", "busybox")
|
||||
@@ -2104,7 +2104,7 @@ func (s *DockerCLIRunSuite) TestRunNoOutputFromPullInStdout(c *testing.T) {
|
||||
func (s *DockerCLIRunSuite) TestRunVolumesCleanPaths(c *testing.T) {
|
||||
testRequires(c, testEnv.IsLocalDaemon)
|
||||
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
||||
buildImageSuccessfully(c, "run_volumes_clean_paths", build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, "run_volumes_clean_paths", build.WithDockerfile(`FROM busybox
|
||||
VOLUME `+prefix+`/foo/`))
|
||||
cli.DockerCmd(c, "run", "-v", prefix+"/foo", "-v", prefix+"/bar/", "--name", "dark_helmet", "run_volumes_clean_paths")
|
||||
|
||||
@@ -3599,7 +3599,7 @@ func (s *DockerCLIRunSuite) TestRunInitLayerPathOwnership(c *testing.T) {
|
||||
// Not applicable on Windows as it does not support Linux uid/gid ownership
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "testetcfileownership"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, name, build.WithDockerfile(`FROM busybox
|
||||
RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd
|
||||
RUN echo 'dockerio:x:1001:' >> /etc/group
|
||||
RUN chown dockerio:dockerio /etc`))
|
||||
@@ -3651,7 +3651,7 @@ func (s *DockerCLIRunSuite) TestRunNamedVolumeCopyImageData(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
testImg := "testvolumecopy"
|
||||
buildImageSuccessfully(c, testImg, build.WithDockerfile(`
|
||||
cli.BuildCmd(c, testImg, build.WithDockerfile(`
|
||||
FROM busybox
|
||||
RUN mkdir -p /foo && echo hello > /foo/hello
|
||||
`))
|
||||
@@ -3770,7 +3770,7 @@ func (s *DockerCLIRunSuite) TestRunVolumeWithOneCharacter(c *testing.T) {
|
||||
|
||||
func (s *DockerCLIRunSuite) TestRunVolumeCopyFlag(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // Windows does not support copying data from image to the volume
|
||||
buildImageSuccessfully(c, "volumecopy", build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, "volumecopy", build.WithDockerfile(`FROM busybox
|
||||
RUN mkdir /foo && echo hello > /foo/bar
|
||||
CMD cat /foo/bar`))
|
||||
cli.DockerCmd(c, "volume", "create", "test")
|
||||
|
||||
@@ -794,7 +794,7 @@ func (s *DockerCLIRunSuite) TestRunTmpfsMounts(c *testing.T) {
|
||||
|
||||
func (s *DockerCLIRunSuite) TestRunTmpfsMountsOverrideImageVolumes(c *testing.T) {
|
||||
const name = "img-with-volumes"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(`
|
||||
cli.BuildCmd(c, name, build.WithDockerfile(`
|
||||
FROM busybox
|
||||
VOLUME /run
|
||||
RUN touch /run/stuff
|
||||
|
||||
@@ -300,7 +300,7 @@ func (s *DockerCLISaveLoadSuite) TestSaveLoadNoTag(c *testing.T) {
|
||||
|
||||
name := "saveloadnotag"
|
||||
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile("FROM busybox\nENV foo=bar"))
|
||||
cli.BuildCmd(c, name, build.WithDockerfile("FROM busybox\nENV foo=bar"))
|
||||
id := inspectField(c, name, "Id")
|
||||
|
||||
// Test to make sure that save w/o name just shows imageID during load
|
||||
|
||||
@@ -78,7 +78,7 @@ func (s *DockerCLISaveLoadSuite) TestSaveAndLoadWithProgressBar(c *testing.T) {
|
||||
skip.If(c, testEnv.UsingSnapshotter(), "TODO: Not implemented yet")
|
||||
|
||||
name := "test-load"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(`FROM busybox
|
||||
cli.BuildCmd(c, name, build.WithDockerfile(`FROM busybox
|
||||
RUN touch aa
|
||||
`))
|
||||
|
||||
|
||||
@@ -471,7 +471,7 @@ func (s *DockerCLIVolumeSuite) TestDuplicateMountpointsForVolumesFrom(c *testing
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
const imgName = "vimage"
|
||||
buildImageSuccessfully(c, imgName, build.WithDockerfile(`
|
||||
cli.BuildCmd(c, imgName, build.WithDockerfile(`
|
||||
FROM busybox
|
||||
VOLUME ["/tmp/data"]`))
|
||||
|
||||
@@ -512,7 +512,7 @@ func (s *DockerCLIVolumeSuite) TestDuplicateMountpointsForVolumesFromAndBind(c *
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
const imgName = "vimage"
|
||||
buildImageSuccessfully(c, imgName, build.WithDockerfile(`
|
||||
cli.BuildCmd(c, imgName, build.WithDockerfile(`
|
||||
FROM busybox
|
||||
VOLUME ["/tmp/data"]`))
|
||||
|
||||
@@ -554,7 +554,7 @@ func (s *DockerCLIVolumeSuite) TestDuplicateMountpointsForVolumesFromAndMounts(c
|
||||
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
|
||||
|
||||
const imgName = "vimage"
|
||||
buildImageSuccessfully(c, imgName, build.WithDockerfile(`
|
||||
cli.BuildCmd(c, imgName, build.WithDockerfile(`
|
||||
FROM busybox
|
||||
VOLUME ["/tmp/data"]`))
|
||||
|
||||
|
||||
@@ -132,17 +132,6 @@ func getIDByName(t *testing.T, name string) string {
|
||||
return id
|
||||
}
|
||||
|
||||
// Deprecated: use cli.Docker
|
||||
func buildImageSuccessfully(t *testing.T, name string, cmdOperators ...cli.CmdOperator) {
|
||||
t.Helper()
|
||||
cli.Docker(cli.Args("build", "-t", name), cmdOperators...).Assert(t, icmd.Success)
|
||||
}
|
||||
|
||||
// Deprecated: use cli.Docker
|
||||
func buildImage(name string, cmdOperators ...cli.CmdOperator) *icmd.Result {
|
||||
return cli.Docker(cli.Args("build", "-t", name), cmdOperators...)
|
||||
}
|
||||
|
||||
// Write `content` to the file at path `dst`, creating it if necessary,
|
||||
// as well as any missing directories.
|
||||
// The file is truncated if it already exists.
|
||||
|
||||
Reference in New Issue
Block a user