mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-01 00:23:56 +08:00 
			
		
		
		
	tests: add simple local bake test
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
		| @@ -18,6 +18,7 @@ func bakeCmd(sb integration.Sandbox, opts ...cmdOpt) (string, error) { | ||||
| } | ||||
|  | ||||
| var bakeTests = []func(t *testing.T, sb integration.Sandbox){ | ||||
| 	testBakeLocal, | ||||
| 	testBakeRemote, | ||||
| 	testBakeRemoteCmdContext, | ||||
| 	testBakeRemoteCmdContextOverride, | ||||
| @@ -26,6 +27,29 @@ var bakeTests = []func(t *testing.T, sb integration.Sandbox){ | ||||
| 	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) { | ||||
| 	bakefile := []byte(` | ||||
| target "default" { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Justin Chadwell
					Justin Chadwell