2018-05-03 10:24:11 -04:00
|
|
|
// +build windows
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
2019-09-09 17:06:12 -04:00
|
|
|
"testing"
|
2018-05-03 10:24:11 -04:00
|
|
|
|
2019-08-29 16:52:40 -04:00
|
|
|
"github.com/docker/docker/testutil/fakecontext"
|
|
|
|
"github.com/docker/docker/testutil/request"
|
2020-02-07 08:39:24 -05:00
|
|
|
"gotest.tools/v3/assert"
|
|
|
|
is "gotest.tools/v3/assert/cmp"
|
2018-05-03 10:24:11 -04:00
|
|
|
)
|
|
|
|
|
2019-09-09 17:05:55 -04:00
|
|
|
func (s *DockerSuite) TestBuildWithRecycleBin(c *testing.T) {
|
2018-05-03 10:24:11 -04:00
|
|
|
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(
|
|
|
|
"/build",
|
|
|
|
request.RawContent(ctx.AsTarReader(c)),
|
|
|
|
request.ContentType("application/x-tar"))
|
|
|
|
|
2019-04-04 09:23:19 -04:00
|
|
|
assert.NilError(c, err)
|
|
|
|
assert.Equal(c, res.StatusCode, http.StatusOK)
|
2018-05-03 10:24:11 -04:00
|
|
|
|
|
|
|
out, err := request.ReadBody(body)
|
|
|
|
assert.NilError(c, err)
|
|
|
|
assert.Check(c, is.Contains(string(out), "Successfully built"))
|
|
|
|
}
|