moby/integration-cli/docker_api_build_windows_test.go
Brian Goff e8dc902781 Wire up tests to support otel tracing
Integration tests will now configure clients to propagate traces as well
as create spans for all tests.

Some extra changes were needed (or desired for trace propagation) in the
test helpers to pass through tracing spans via context.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2023-09-07 18:38:22 +00:00

39 lines
998 B
Go

//go:build windows
package main
import (
"net/http"
"testing"
"github.com/docker/docker/testutil"
"github.com/docker/docker/testutil/fakecontext"
"github.com/docker/docker/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"))
}