mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-21 11:17:44 +08:00
tests: add bake test for remote subdir context
Fixed in 12b6a3ad9aeda4bdf67a6a55d22fc43594125ec4, but now we have regression tests! So we can add a check that we don't break this behavior again. Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
parent
e859ebc12e
commit
61a7854659
@ -22,6 +22,7 @@ var bakeTests = []func(t *testing.T, sb integration.Sandbox){
|
|||||||
testBakeRemote,
|
testBakeRemote,
|
||||||
testBakeRemoteCmdContext,
|
testBakeRemoteCmdContext,
|
||||||
testBakeRemoteCmdContextOverride,
|
testBakeRemoteCmdContextOverride,
|
||||||
|
testBakeRemoteContextSubdir,
|
||||||
}
|
}
|
||||||
|
|
||||||
func testBakeRemote(t *testing.T, sb integration.Sandbox) {
|
func testBakeRemote(t *testing.T, sb integration.Sandbox) {
|
||||||
@ -127,3 +128,37 @@ EOT
|
|||||||
|
|
||||||
require.FileExists(t, filepath.Join(dirDest, "foo"))
|
require.FileExists(t, filepath.Join(dirDest, "foo"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/docker/buildx/issues/1738
|
||||||
|
func testBakeRemoteContextSubdir(t *testing.T, sb integration.Sandbox) {
|
||||||
|
bakefile := []byte(`
|
||||||
|
target default {
|
||||||
|
context = "./bar"
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
dockerfile := []byte(`
|
||||||
|
FROM scratch
|
||||||
|
COPY super-cool.txt /
|
||||||
|
`)
|
||||||
|
|
||||||
|
dir := tmpdir(
|
||||||
|
t,
|
||||||
|
fstest.CreateFile("docker-bake.hcl", bakefile, 0600),
|
||||||
|
fstest.CreateDir("bar", 0700),
|
||||||
|
fstest.CreateFile("bar/Dockerfile", dockerfile, 0600),
|
||||||
|
fstest.CreateFile("bar/super-cool.txt", []byte("super cool"), 0600),
|
||||||
|
)
|
||||||
|
dirDest := t.TempDir()
|
||||||
|
|
||||||
|
git, err := gitutil.New(gitutil.WithWorkingDir(dir))
|
||||||
|
require.NoError(t, err)
|
||||||
|
gitutil.GitInit(git, t)
|
||||||
|
gitutil.GitAdd(git, t, "docker-bake.hcl", "bar")
|
||||||
|
gitutil.GitCommit(git, t, "initial commit")
|
||||||
|
addr := gitutil.GitServeHTTP(git, t)
|
||||||
|
|
||||||
|
out, err := bakeCmd(sb, "/tmp", addr, "--set", "*.output=type=local,dest="+dirDest)
|
||||||
|
require.NoError(t, err, out)
|
||||||
|
|
||||||
|
require.FileExists(t, filepath.Join(dirDest, "super-cool.txt"))
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user