1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/integration-cli/docker_api_build_windows_test.go
Sam Whited b37c214e3c testutil: make testing packages public
This was done with something along the lines of:

```
mv internal/test testutil
pushd testutil/; grep -IRl "package test" | xargs -I '{}' sed -i -e 's|package test|package testutil|g' {}; popd
mv internal/testutil/*.go testutil/ && rm -rf internal/
grep -IRl "github.com\/docker\/docker\/internal\/test" | xargs -I '{}' sed -i -e 's|github.com/docker/docker/internal/test|github.com/docker/docker/test|g' {}
goimports .
```

I also modified the basic plugin path in testutil/fixtures/plugin.

Signed-off-by: Sam Whited <sam@samwhited.com>
2019-09-11 07:47:23 -05:00

38 lines
928 B
Go

// +build windows
package main
import (
"net/http"
"testing"
"github.com/docker/docker/testutil/fakecontext"
"github.com/docker/docker/testutil/request"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)
func (s *DockerSuite) 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(
"/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"))
}