mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Using test names instead of hardcoded ones in integration/image directory
Signed-off-by: Cristina Yenyxe Gonzalez Garcia <cristina.yenyxe@gmail.com>
This commit is contained in:
parent
4cabad6bae
commit
0154dc7a23
4 changed files with 17 additions and 11 deletions
|
@ -2,6 +2,7 @@ package image // import "github.com/docker/docker/integration/image"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
@ -20,10 +21,11 @@ func TestCommitInheritsEnv(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
cID1 := container.Create(ctx, t, client)
|
cID1 := container.Create(ctx, t, client)
|
||||||
|
imgName := strings.ToLower(t.Name())
|
||||||
|
|
||||||
commitResp1, err := client.ContainerCommit(ctx, cID1, types.ContainerCommitOptions{
|
commitResp1, err := client.ContainerCommit(ctx, cID1, types.ContainerCommitOptions{
|
||||||
Changes: []string{"ENV PATH=/bin"},
|
Changes: []string{"ENV PATH=/bin"},
|
||||||
Reference: "test-commit-image",
|
Reference: imgName,
|
||||||
})
|
})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
|
@ -37,7 +39,7 @@ func TestCommitInheritsEnv(t *testing.T) {
|
||||||
|
|
||||||
commitResp2, err := client.ContainerCommit(ctx, cID2, types.ContainerCommitOptions{
|
commitResp2, err := client.ContainerCommit(ctx, cID2, types.ContainerCommitOptions{
|
||||||
Changes: []string{"ENV PATH=/usr/bin:$PATH"},
|
Changes: []string{"ENV PATH=/usr/bin:$PATH"},
|
||||||
Reference: "test-commit-image",
|
Reference: imgName,
|
||||||
})
|
})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
@ -38,10 +39,11 @@ func TestImportExtremelyLargeImageWorks(t *testing.T) {
|
||||||
err := tw.Close()
|
err := tw.Close()
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
imageRdr := io.MultiReader(&tarBuffer, io.LimitReader(testutil.DevZero, 8*1024*1024*1024))
|
imageRdr := io.MultiReader(&tarBuffer, io.LimitReader(testutil.DevZero, 8*1024*1024*1024))
|
||||||
|
reference := strings.ToLower(t.Name()) + ":v42"
|
||||||
|
|
||||||
_, err = client.ImageImport(context.Background(),
|
_, err = client.ImageImport(context.Background(),
|
||||||
types.ImageImportSource{Source: imageRdr, SourceName: "-"},
|
types.ImageImportSource{Source: imageRdr, SourceName: "-"},
|
||||||
"test1234:v42",
|
reference,
|
||||||
types.ImageImportOptions{})
|
types.ImageImportOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package image // import "github.com/docker/docker/integration/image"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
@ -19,7 +20,7 @@ func TestImagesFilterMultiReference(t *testing.T) {
|
||||||
client := testEnv.APIClient()
|
client := testEnv.APIClient()
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
name := "images_filter_multi_reference"
|
name := strings.ToLower(t.Name())
|
||||||
repoTags := []string{
|
repoTags := []string{
|
||||||
name + ":v1",
|
name + ":v1",
|
||||||
name + ":v2",
|
name + ":v2",
|
||||||
|
|
|
@ -2,6 +2,7 @@ package image // import "github.com/docker/docker/integration/image"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
@ -17,36 +18,36 @@ func TestRemoveImageOrphaning(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
client := testEnv.APIClient()
|
client := testEnv.APIClient()
|
||||||
|
|
||||||
img := "test-container-orphaning"
|
imgName := strings.ToLower(t.Name())
|
||||||
|
|
||||||
// Create a container from busybox, and commit a small change so we have a new image
|
// Create a container from busybox, and commit a small change so we have a new image
|
||||||
cID1 := container.Create(ctx, t, client, container.WithCmd(""))
|
cID1 := container.Create(ctx, t, client, container.WithCmd(""))
|
||||||
commitResp1, err := client.ContainerCommit(ctx, cID1, types.ContainerCommitOptions{
|
commitResp1, err := client.ContainerCommit(ctx, cID1, types.ContainerCommitOptions{
|
||||||
Changes: []string{`ENTRYPOINT ["true"]`},
|
Changes: []string{`ENTRYPOINT ["true"]`},
|
||||||
Reference: img,
|
Reference: imgName,
|
||||||
})
|
})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
// verifies that reference now points to first image
|
// verifies that reference now points to first image
|
||||||
resp, _, err := client.ImageInspectWithRaw(ctx, img)
|
resp, _, err := client.ImageInspectWithRaw(ctx, imgName)
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
assert.Check(t, is.Equal(resp.ID, commitResp1.ID))
|
assert.Check(t, is.Equal(resp.ID, commitResp1.ID))
|
||||||
|
|
||||||
// Create a container from created image, and commit a small change with same reference name
|
// Create a container from created image, and commit a small change with same reference name
|
||||||
cID2 := container.Create(ctx, t, client, container.WithImage(img), container.WithCmd(""))
|
cID2 := container.Create(ctx, t, client, container.WithImage(imgName), container.WithCmd(""))
|
||||||
commitResp2, err := client.ContainerCommit(ctx, cID2, types.ContainerCommitOptions{
|
commitResp2, err := client.ContainerCommit(ctx, cID2, types.ContainerCommitOptions{
|
||||||
Changes: []string{`LABEL Maintainer="Integration Tests"`},
|
Changes: []string{`LABEL Maintainer="Integration Tests"`},
|
||||||
Reference: img,
|
Reference: imgName,
|
||||||
})
|
})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
// verifies that reference now points to second image
|
// verifies that reference now points to second image
|
||||||
resp, _, err = client.ImageInspectWithRaw(ctx, img)
|
resp, _, err = client.ImageInspectWithRaw(ctx, imgName)
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
assert.Check(t, is.Equal(resp.ID, commitResp2.ID))
|
assert.Check(t, is.Equal(resp.ID, commitResp2.ID))
|
||||||
|
|
||||||
// try to remove the image, should not error out.
|
// try to remove the image, should not error out.
|
||||||
_, err = client.ImageRemove(ctx, img, types.ImageRemoveOptions{})
|
_, err = client.ImageRemove(ctx, imgName, types.ImageRemoveOptions{})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
// check if the first image is still there
|
// check if the first image is still there
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue