mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add TestBuildWCOWSandboxSize integration test
This test validates that `RUN` and `COPY` both target a read-write sandbox on Windows that is configured according to the daemon's `storage-opts` setting. Sadly, this is a slow test, so we need to bump the timeout to 60 minutes from the default of 10 minutes. Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
This commit is contained in:
parent
0e8023ddea
commit
142b2b785b
2 changed files with 41 additions and 1 deletions
|
@ -363,7 +363,7 @@ Function Run-IntegrationTests() {
|
|||
$pinfo.FileName = "gotestsum.exe"
|
||||
$pinfo.WorkingDirectory = "$($PWD.Path)"
|
||||
$pinfo.UseShellExecute = $false
|
||||
$pinfo.Arguments = "--format=standard-verbose --jsonfile=$jsonFilePath --junitfile=$xmlFilePath -- $env:INTEGRATION_TESTFLAGS"
|
||||
$pinfo.Arguments = "--format=standard-verbose --jsonfile=$jsonFilePath --junitfile=$xmlFilePath -- -test.timeout=60m $env:INTEGRATION_TESTFLAGS"
|
||||
$p = New-Object System.Diagnostics.Process
|
||||
$p.StartInfo = $pinfo
|
||||
$p.Start() | Out-Null
|
||||
|
|
|
@ -523,6 +523,46 @@ RUN for g in $(seq 0 8); do dd if=/dev/urandom of=rnd bs=1K count=1 seek=$((1024
|
|||
assert.Check(t, is.Contains(out.String(), "Successfully built"))
|
||||
}
|
||||
|
||||
func TestBuildWCOWSandboxSize(t *testing.T) {
|
||||
skip.If(t, testEnv.DaemonInfo.OSType != "windows", "only Windows has sandbox size control")
|
||||
ctx := context.TODO()
|
||||
defer setupTest(t)()
|
||||
|
||||
dockerfile := `FROM busybox AS intermediate
|
||||
WORKDIR C:\\stuff
|
||||
# Create and delete a 21GB file
|
||||
RUN fsutil file createnew C:\\stuff\\bigfile_0.txt 22548578304 && del bigfile_0.txt
|
||||
# Create three 7GB files
|
||||
RUN fsutil file createnew C:\\stuff\\bigfile_1.txt 7516192768
|
||||
RUN fsutil file createnew C:\\stuff\\bigfile_2.txt 7516192768
|
||||
RUN fsutil file createnew C:\\stuff\\bigfile_3.txt 7516192768
|
||||
# Copy that 21GB of data out into a new target
|
||||
FROM busybox
|
||||
COPY --from=intermediate C:\\stuff C:\\stuff
|
||||
`
|
||||
|
||||
buf := bytes.NewBuffer(nil)
|
||||
w := tar.NewWriter(buf)
|
||||
writeTarRecord(t, w, "Dockerfile", dockerfile)
|
||||
err := w.Close()
|
||||
assert.NilError(t, err)
|
||||
|
||||
apiclient := testEnv.APIClient()
|
||||
resp, err := apiclient.ImageBuild(ctx,
|
||||
buf,
|
||||
types.ImageBuildOptions{
|
||||
Remove: true,
|
||||
ForceRemove: true,
|
||||
})
|
||||
|
||||
out := bytes.NewBuffer(nil)
|
||||
assert.NilError(t, err)
|
||||
_, err = io.Copy(out, resp.Body)
|
||||
resp.Body.Close()
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Contains(out.String(), "Successfully built"))
|
||||
}
|
||||
|
||||
func TestBuildWithEmptyDockerfile(t *testing.T) {
|
||||
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.40"), "broken in earlier versions")
|
||||
ctx := context.TODO()
|
||||
|
|
Loading…
Reference in a new issue