From 446ca8c7641591e246acf5e21d536116c32648ca Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Mon, 7 Aug 2023 11:18:31 +0200 Subject: [PATCH] integration: test remote compose with include Signed-off-by: CrazyMax --- tests/bake.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/bake.go b/tests/bake.go index b76a8bb8..7e890c54 100644 --- a/tests/bake.go +++ b/tests/bake.go @@ -25,6 +25,7 @@ var bakeTests = []func(t *testing.T, sb integration.Sandbox){ testBakeRemoteContextSubdir, testBakeRemoteCmdContextEscapeRoot, testBakeRemoteCmdContextEscapeRelative, + testBakeRemoteComposeInclude, } func testBakeLocal(t *testing.T, sb integration.Sandbox) { @@ -287,3 +288,47 @@ EOT require.NoError(t, err, out) require.FileExists(t, filepath.Join(dirDest, "foo")) } + +func testBakeRemoteComposeInclude(t *testing.T, sb integration.Sandbox) { + composeFile := []byte(` +include: + - compose-inc.yml + +services: + foo: + build: + context: . + dockerfile_inline: | + FROM busybox + RUN echo foo +`) + composeIncFile := []byte(` +services: + inc: + build: + context: . + dockerfile_inline: | + FROM busybox + RUN echo inc +`) + + dirSpec := tmpdir( + t, + fstest.CreateFile("compose.yml", composeFile, 0600), + fstest.CreateFile("compose-inc.yml", composeIncFile, 0600), + ) + + git, err := gitutil.New(gitutil.WithWorkingDir(dirSpec)) + require.NoError(t, err) + + gitutil.GitInit(git, t) + gitutil.GitAdd(git, t, "compose.yml", "compose-inc.yml") + gitutil.GitCommit(git, t, "initial commit") + addr := gitutil.GitServeHTTP(git, t) + + out, err := bakeCmd( + sb, + withArgs(addr, "--set", "*.output=type=cacheonly"), + ) + require.NoError(t, err, out) +}