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/build directory
Signed-off-by: Cristina Yenyxe Gonzalez Garcia <cristina.yenyxe@gmail.com>
This commit is contained in:
parent
327a0b4ae4
commit
ebd025b63a
3 changed files with 11 additions and 10 deletions
|
@ -48,7 +48,7 @@ func TestBuildSquashParent(t *testing.T) {
|
||||||
source := fakecontext.New(t, "", fakecontext.WithDockerfile(dockerfile))
|
source := fakecontext.New(t, "", fakecontext.WithDockerfile(dockerfile))
|
||||||
defer source.Close()
|
defer source.Close()
|
||||||
|
|
||||||
name := "test"
|
name := strings.ToLower(t.Name())
|
||||||
resp, err := client.ImageBuild(ctx,
|
resp, err := client.ImageBuild(ctx,
|
||||||
source.AsTarReader(t),
|
source.AsTarReader(t),
|
||||||
types.ImageBuildOptions{
|
types.ImageBuildOptions{
|
||||||
|
|
|
@ -207,19 +207,20 @@ func TestBuildMultiStageParentConfig(t *testing.T) {
|
||||||
defer source.Close()
|
defer source.Close()
|
||||||
|
|
||||||
apiclient := testEnv.APIClient()
|
apiclient := testEnv.APIClient()
|
||||||
|
imgName := strings.ToLower(t.Name())
|
||||||
resp, err := apiclient.ImageBuild(ctx,
|
resp, err := apiclient.ImageBuild(ctx,
|
||||||
source.AsTarReader(t),
|
source.AsTarReader(t),
|
||||||
types.ImageBuildOptions{
|
types.ImageBuildOptions{
|
||||||
Remove: true,
|
Remove: true,
|
||||||
ForceRemove: true,
|
ForceRemove: true,
|
||||||
Tags: []string{"build1"},
|
Tags: []string{imgName},
|
||||||
})
|
})
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
_, err = io.Copy(ioutil.Discard, resp.Body)
|
_, err = io.Copy(ioutil.Discard, resp.Body)
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
image, _, err := apiclient.ImageInspectWithRaw(ctx, "build1")
|
image, _, err := apiclient.ImageInspectWithRaw(ctx, imgName)
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
expected := "/foo/sub2"
|
expected := "/foo/sub2"
|
||||||
|
@ -234,7 +235,7 @@ func TestBuildMultiStageParentConfig(t *testing.T) {
|
||||||
func TestBuildLabelWithTargets(t *testing.T) {
|
func TestBuildLabelWithTargets(t *testing.T) {
|
||||||
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.38"), "test added after 1.38")
|
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.38"), "test added after 1.38")
|
||||||
skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
|
skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
|
||||||
bldName := "build-a"
|
imgName := strings.ToLower(t.Name() + "-a")
|
||||||
testLabels := map[string]string{
|
testLabels := map[string]string{
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
"dead": "beef",
|
"dead": "beef",
|
||||||
|
@ -260,7 +261,7 @@ func TestBuildLabelWithTargets(t *testing.T) {
|
||||||
types.ImageBuildOptions{
|
types.ImageBuildOptions{
|
||||||
Remove: true,
|
Remove: true,
|
||||||
ForceRemove: true,
|
ForceRemove: true,
|
||||||
Tags: []string{bldName},
|
Tags: []string{imgName},
|
||||||
Labels: testLabels,
|
Labels: testLabels,
|
||||||
Target: "target-a",
|
Target: "target-a",
|
||||||
})
|
})
|
||||||
|
@ -269,7 +270,7 @@ func TestBuildLabelWithTargets(t *testing.T) {
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
image, _, err := apiclient.ImageInspectWithRaw(ctx, bldName)
|
image, _, err := apiclient.ImageInspectWithRaw(ctx, imgName)
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
testLabels["label-a"] = "inline-a"
|
testLabels["label-a"] = "inline-a"
|
||||||
|
@ -280,14 +281,14 @@ func TestBuildLabelWithTargets(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// For `target-b` build
|
// For `target-b` build
|
||||||
bldName = "build-b"
|
imgName = strings.ToLower(t.Name() + "-b")
|
||||||
delete(testLabels, "label-a")
|
delete(testLabels, "label-a")
|
||||||
resp, err = apiclient.ImageBuild(ctx,
|
resp, err = apiclient.ImageBuild(ctx,
|
||||||
source.AsTarReader(t),
|
source.AsTarReader(t),
|
||||||
types.ImageBuildOptions{
|
types.ImageBuildOptions{
|
||||||
Remove: true,
|
Remove: true,
|
||||||
ForceRemove: true,
|
ForceRemove: true,
|
||||||
Tags: []string{bldName},
|
Tags: []string{imgName},
|
||||||
Labels: testLabels,
|
Labels: testLabels,
|
||||||
Target: "target-b",
|
Target: "target-b",
|
||||||
})
|
})
|
||||||
|
@ -296,7 +297,7 @@ func TestBuildLabelWithTargets(t *testing.T) {
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
image, _, err = apiclient.ImageInspectWithRaw(ctx, bldName)
|
image, _, err = apiclient.ImageInspectWithRaw(ctx, imgName)
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
testLabels["label-b"] = "inline-b"
|
testLabels["label-b"] = "inline-b"
|
||||||
|
@ -581,7 +582,7 @@ func TestBuildPreserveOwnership(t *testing.T) {
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
dockerfile, err := ioutil.ReadFile("testdata/Dockerfile.testBuildPreserveOwnership")
|
dockerfile, err := ioutil.ReadFile("testdata/Dockerfile." + t.Name())
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
source := fakecontext.New(t, "", fakecontext.WithDockerfile(string(dockerfile)))
|
source := fakecontext.New(t, "", fakecontext.WithDockerfile(string(dockerfile)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue