mirror of
https://github.com/moby/moby.git
synced 2026-01-11 02:31:44 +00:00
This package was originally internal, but was moved out when BuildKit used it for its integration tests. That's no longer the case, so we can make it internal again. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
40 lines
1022 B
Go
40 lines
1022 B
Go
//go:build windows
|
|
|
|
package main
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/moby/moby/v2/internal/testutil"
|
|
"github.com/moby/moby/v2/internal/testutil/fakecontext"
|
|
"github.com/moby/moby/v2/internal/testutil/request"
|
|
"gotest.tools/v3/assert"
|
|
is "gotest.tools/v3/assert/cmp"
|
|
)
|
|
|
|
func (s *DockerAPISuite) TestBuildWithRecycleBin(c *testing.T) {
|
|
testRequires(c, DaemonIsWindows)
|
|
|
|
dockerfile := "" +
|
|
"FROM " + testEnv.PlatformDefaults.BaseImage + "\n" +
|
|
"RUN md $REcycLE.biN && md missing\n" +
|
|
"RUN dir $Recycle.Bin && exit 1 || exit 0\n" +
|
|
"RUN dir missing\n"
|
|
|
|
ctx := fakecontext.New(c, "", fakecontext.WithDockerfile(dockerfile))
|
|
defer ctx.Close()
|
|
|
|
res, body, err := request.Post(testutil.GetContext(c),
|
|
"/build",
|
|
request.RawContent(ctx.AsTarReader(c)),
|
|
request.ContentType("application/x-tar"))
|
|
|
|
assert.NilError(c, err)
|
|
assert.Equal(c, res.StatusCode, http.StatusOK)
|
|
|
|
out, err := request.ReadBody(body)
|
|
assert.NilError(c, err)
|
|
assert.Check(c, is.Contains(string(out), "Successfully built"))
|
|
}
|