Skip to content

Commit

Permalink
reproduce tar exporter with socket error
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
  • Loading branch information
alexcb committed Jul 18, 2020
1 parent 4d1f260 commit ed029cf
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func TestIntegration(t *testing.T) {
testCacheMountNoCache,
testExporterTargetExists,
testTarExporterWithSocket,
testTarExporterWithSocketCopy,
testTarExporterSymlink,
testMultipleRegistryCacheImportExport,
testSourceMap,
Expand Down Expand Up @@ -1653,6 +1654,48 @@ func testTarExporterWithSocket(t *testing.T, sb integration.Sandbox) {
require.NoError(t, err)
}

func testTarExporterWithSocketCopy(t *testing.T, sb integration.Sandbox) {
if os.Getenv("TEST_DOCKERD") == "1" {
t.Skip("tar exporter is temporarily broken on dockerd")
}

requiresLinux(t)
c, err := New(context.TODO(), sb.Address())
require.NoError(t, err)
defer c.Close()

alpine := llb.Image("docker.io/library/alpine:latest")
state := alpine.Run(llb.Args([]string{"sh", "-c", "nc -l -s local:/root/socket.sock & usleep 100000; kill %1"})).Root()

fa := llb.Copy(state, "/root", "/roo2",
&llb.CopyInfo{
FollowSymlinks: true,
CopyDirContentsOnly: false, // !isDir
AttemptUnpack: false,
CreateDestPath: true,
AllowWildcard: true,
AllowEmptyWildcard: false,
})

alpine2 := alpine.File(fa)

def, err := alpine2.Marshal(context.TODO())
require.NoError(t, err)

_, err = c.Solve(context.TODO(), def, SolveOpt{
Exports: []ExportEntry{
{
Type: ExporterTar,
Attrs: map[string]string{},
Output: func(m map[string]string) (io.WriteCloser, error) {
return nopWriteCloser{ioutil.Discard}, nil
},
},
},
}, nil)
require.NoError(t, err)
}

// moby/buildkit#1418
func testTarExporterSymlink(t *testing.T, sb integration.Sandbox) {
requiresLinux(t)
Expand Down

0 comments on commit ed029cf

Please sign in to comment.