mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 09:17:49 +08:00
test: align build call tests
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
d3a53189f7
commit
9de95d81eb
@ -64,7 +64,7 @@ var buildTests = []func(t *testing.T, sb integration.Sandbox){
|
|||||||
testBuildLoadPush,
|
testBuildLoadPush,
|
||||||
testBuildSecret,
|
testBuildSecret,
|
||||||
testBuildDefaultLoad,
|
testBuildDefaultLoad,
|
||||||
testBuildPrint,
|
testBuildCall,
|
||||||
}
|
}
|
||||||
|
|
||||||
func testBuild(t *testing.T, sb integration.Sandbox) {
|
func testBuild(t *testing.T, sb integration.Sandbox) {
|
||||||
@ -797,12 +797,8 @@ func testBuildDefaultLoad(t *testing.T, sb integration.Sandbox) {
|
|||||||
require.NoError(t, cmd.Run())
|
require.NoError(t, cmd.Run())
|
||||||
}
|
}
|
||||||
|
|
||||||
func testBuildPrint(t *testing.T, sb integration.Sandbox) {
|
func testBuildCall(t *testing.T, sb integration.Sandbox) {
|
||||||
if !isExperimental() {
|
t.Run("check", func(t *testing.T) {
|
||||||
t.Skip("experimental mode required, skipping")
|
|
||||||
}
|
|
||||||
|
|
||||||
t.Run("lint", func(t *testing.T) {
|
|
||||||
dockerfile := []byte(`
|
dockerfile := []byte(`
|
||||||
frOM busybox as base
|
frOM busybox as base
|
||||||
cOpy Dockerfile .
|
cOpy Dockerfile .
|
||||||
@ -816,7 +812,7 @@ COPy --from=base \
|
|||||||
fstest.CreateFile("Dockerfile", dockerfile, 0600),
|
fstest.CreateFile("Dockerfile", dockerfile, 0600),
|
||||||
)
|
)
|
||||||
|
|
||||||
cmd := buildxCmd(sb, withArgs("build", "--print=lint,format=json", dir))
|
cmd := buildxCmd(sb, withArgs("build", "--call=check,format=json", dir))
|
||||||
stdout := bytes.Buffer{}
|
stdout := bytes.Buffer{}
|
||||||
stderr := bytes.Buffer{}
|
stderr := bytes.Buffer{}
|
||||||
cmd.Stdout = &stdout
|
cmd.Stdout = &stdout
|
||||||
@ -851,7 +847,7 @@ FROM second
|
|||||||
fstest.CreateFile("Dockerfile", dockerfile, 0600),
|
fstest.CreateFile("Dockerfile", dockerfile, 0600),
|
||||||
)
|
)
|
||||||
|
|
||||||
cmd := buildxCmd(sb, withArgs("build", "--build-arg=BAR=678", "--target=target", "--print=outline,format=json", dir))
|
cmd := buildxCmd(sb, withArgs("build", "--build-arg=BAR=678", "--target=target", "--call=outline,format=json", dir))
|
||||||
stdout := bytes.Buffer{}
|
stdout := bytes.Buffer{}
|
||||||
stderr := bytes.Buffer{}
|
stderr := bytes.Buffer{}
|
||||||
cmd.Stdout = &stdout
|
cmd.Stdout = &stdout
|
||||||
@ -901,7 +897,7 @@ FROM second AS binary
|
|||||||
fstest.CreateFile("Dockerfile", dockerfile, 0600),
|
fstest.CreateFile("Dockerfile", dockerfile, 0600),
|
||||||
)
|
)
|
||||||
|
|
||||||
cmd := buildxCmd(sb, withArgs("build", "--print=targets,format=json", dir))
|
cmd := buildxCmd(sb, withArgs("build", "--call=targets,format=json", dir))
|
||||||
stdout := bytes.Buffer{}
|
stdout := bytes.Buffer{}
|
||||||
stderr := bytes.Buffer{}
|
stderr := bytes.Buffer{}
|
||||||
cmd.Stdout = &stdout
|
cmd.Stdout = &stdout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user