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