tests: add simple local bake test

Signed-off-by: Justin Chadwell <me@jedevc.com>
pull/1916/head
Justin Chadwell 2 years ago
parent bd672eaf5b
commit 0dcbed3f53

@ -18,6 +18,7 @@ func bakeCmd(sb integration.Sandbox, opts ...cmdOpt) (string, error) {
} }
var bakeTests = []func(t *testing.T, sb integration.Sandbox){ var bakeTests = []func(t *testing.T, sb integration.Sandbox){
testBakeLocal,
testBakeRemote, testBakeRemote,
testBakeRemoteCmdContext, testBakeRemoteCmdContext,
testBakeRemoteCmdContextOverride, testBakeRemoteCmdContextOverride,
@ -26,6 +27,29 @@ var bakeTests = []func(t *testing.T, sb integration.Sandbox){
testBakeRemoteCmdContextEscapeRelative, testBakeRemoteCmdContextEscapeRelative,
} }
func testBakeLocal(t *testing.T, sb integration.Sandbox) {
dockerfile := []byte(`
FROM scratch
COPY foo /foo
`)
bakefile := []byte(`
target "default" {
}
`)
dir := tmpdir(
t,
fstest.CreateFile("docker-bake.hcl", bakefile, 0600),
fstest.CreateFile("Dockerfile", dockerfile, 0600),
fstest.CreateFile("foo", []byte("foo"), 0600),
)
dirDest := t.TempDir()
out, err := bakeCmd(sb, withDir(dir), withArgs("--set", "*.output=type=local,dest="+dirDest))
require.NoError(t, err, out)
require.FileExists(t, filepath.Join(dirDest, "foo"))
}
func testBakeRemote(t *testing.T, sb integration.Sandbox) { func testBakeRemote(t *testing.T, sb integration.Sandbox) {
bakefile := []byte(` bakefile := []byte(`
target "default" { target "default" {

Loading…
Cancel
Save