Skip to content

Commit 6e483a2

Browse files
jedevctonistiigi
authored andcommitted
tests: add test for unicode filenames
Signed-off-by: Justin Chadwell <[email protected]> (cherry picked from commit f9f2a00)
1 parent 2ff0d2a commit 6e483a2

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

frontend/dockerfile/dockerfile_test.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ var allTests = integration.TestFuncs(
166166
testSBOMScannerArgs,
167167
testMultiPlatformWarnings,
168168
testNilContextInSolveGateway,
169+
testCopyUnicodePath,
169170
)
170171

171172
// Tests that depend on the `security.*` entitlements
@@ -6732,6 +6733,46 @@ func testNilContextInSolveGateway(t *testing.T, sb integration.Sandbox) {
67326733
require.ErrorContains(t, err, "invalid nil input definition to definition op")
67336734
}
67346735

6736+
func testCopyUnicodePath(t *testing.T, sb integration.Sandbox) {
6737+
f := getFrontend(t, sb)
6738+
c, err := client.New(sb.Context(), sb.Address())
6739+
require.NoError(t, err)
6740+
defer c.Close()
6741+
6742+
dockerfile := []byte(`
6743+
FROM alpine
6744+
COPY test-äöü.txt /
6745+
`)
6746+
6747+
dir, err := integration.Tmpdir(
6748+
t,
6749+
fstest.CreateFile("Dockerfile", dockerfile, 0600),
6750+
fstest.CreateFile("test-äöü.txt", []byte("test"), 0644),
6751+
)
6752+
require.NoError(t, err)
6753+
6754+
destDir, err := integration.Tmpdir(t)
6755+
require.NoError(t, err)
6756+
6757+
_, err = f.Solve(sb.Context(), c, client.SolveOpt{
6758+
Exports: []client.ExportEntry{
6759+
{
6760+
Type: client.ExporterLocal,
6761+
OutputDir: destDir,
6762+
},
6763+
},
6764+
LocalDirs: map[string]string{
6765+
dockerui.DefaultLocalNameDockerfile: dir,
6766+
dockerui.DefaultLocalNameContext: dir,
6767+
},
6768+
}, nil)
6769+
require.NoError(t, err)
6770+
6771+
dt, err := os.ReadFile(filepath.Join(destDir, "test-äöü.txt"))
6772+
require.NoError(t, err)
6773+
require.Equal(t, "test", string(dt))
6774+
}
6775+
67356776
func runShell(dir string, cmds ...string) error {
67366777
for _, args := range cmds {
67376778
var cmd *exec.Cmd

0 commit comments

Comments
 (0)