1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #36606 from kolyshkin/t-36561

integration/TestExportContainerAfterDaemonRestart: add
This commit is contained in:
Vincent Demeester 2018-03-16 12:07:46 +01:00 committed by GitHub
commit 823de22db6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,9 @@ import (
"time"
"github.com/docker/docker/api/types"
containerTypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/integration-cli/daemon"
"github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/integration/internal/request"
"github.com/docker/docker/pkg/jsonmessage"
@ -51,3 +53,32 @@ func TestExportContainerAndImportImage(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, jm.Status, images[0].ID)
}
// TestExportContainerAfterDaemonRestart checks that a container
// created before start of the currently running dockerd
// can be exported (as reported in #36561). To satisfy this
// condition, daemon restart is needed after container creation.
func TestExportContainerAfterDaemonRestart(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
skip.If(t, testEnv.IsRemoteDaemon())
d := daemon.New(t, "", "dockerd", daemon.Config{})
client, err := d.NewClient()
require.NoError(t, err)
d.StartWithBusybox(t)
defer d.Stop(t)
ctx := context.Background()
cfg := containerTypes.Config{
Image: "busybox",
Cmd: []string{"top"},
}
ctr, err := client.ContainerCreate(ctx, &cfg, nil, nil, "")
require.NoError(t, err)
d.Restart(t)
_, err = client.ContainerExport(ctx, ctr.ID)
assert.NoError(t, err)
}