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

Skip some test on remote daemon for e2e run(s)

We really need to run those on the CI too at some point.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Vincent Demeester 2018-04-25 11:03:43 +02:00 committed by Tibor Vass
parent 1a57535aa2
commit ef2c2040c2
11 changed files with 24 additions and 25 deletions

View file

@ -8,23 +8,20 @@ import (
"testing" "testing"
dclient "github.com/docker/docker/client" dclient "github.com/docker/docker/client"
"github.com/docker/docker/internal/test/daemon"
"github.com/docker/docker/internal/test/fakecontext" "github.com/docker/docker/internal/test/fakecontext"
"github.com/docker/docker/internal/test/request" "github.com/docker/docker/internal/test/request"
"github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp" is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/gotestyourself/gotestyourself/skip"
"github.com/moby/buildkit/session" "github.com/moby/buildkit/session"
"github.com/moby/buildkit/session/filesync" "github.com/moby/buildkit/session/filesync"
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
) )
func TestBuildWithSession(t *testing.T) { func TestBuildWithSession(t *testing.T) {
d := daemon.New(t, daemon.WithExperimental) skip.If(t, !testEnv.DaemonInfo.ExperimentalBuild)
d.StartWithBusybox(t)
defer d.Stop(t)
client, err := d.NewClient() client := testEnv.APIClient()
assert.NilError(t, err)
dockerfile := ` dockerfile := `
FROM busybox FROM busybox
@ -37,7 +34,7 @@ func TestBuildWithSession(t *testing.T) {
) )
defer fctx.Close() defer fctx.Close()
out := testBuildWithSession(t, client, d.Sock(), fctx.Dir, dockerfile) out := testBuildWithSession(t, client, client.DaemonHost(), fctx.Dir, dockerfile)
assert.Check(t, is.Contains(out, "some content")) assert.Check(t, is.Contains(out, "some content"))
fctx.Add("second", "contentcontent") fctx.Add("second", "contentcontent")
@ -47,7 +44,7 @@ func TestBuildWithSession(t *testing.T) {
RUN cat /second RUN cat /second
` `
out = testBuildWithSession(t, client, d.Sock(), fctx.Dir, dockerfile) out = testBuildWithSession(t, client, client.DaemonHost(), fctx.Dir, dockerfile)
assert.Check(t, is.Equal(strings.Count(out, "Using cache"), 2)) assert.Check(t, is.Equal(strings.Count(out, "Using cache"), 2))
assert.Check(t, is.Contains(out, "contentcontent")) assert.Check(t, is.Contains(out, "contentcontent"))
@ -55,7 +52,7 @@ func TestBuildWithSession(t *testing.T) {
assert.Check(t, err) assert.Check(t, err)
assert.Check(t, du.BuilderSize > 10) assert.Check(t, du.BuilderSize > 10)
out = testBuildWithSession(t, client, d.Sock(), fctx.Dir, dockerfile) out = testBuildWithSession(t, client, client.DaemonHost(), fctx.Dir, dockerfile)
assert.Check(t, is.Equal(strings.Count(out, "Using cache"), 4)) assert.Check(t, is.Equal(strings.Count(out, "Using cache"), 4))
du2, err := client.DiskUsage(context.TODO()) du2, err := client.DiskUsage(context.TODO())
@ -67,7 +64,7 @@ func TestBuildWithSession(t *testing.T) {
// FIXME(vdemeester) use sock here // FIXME(vdemeester) use sock here
res, body, err := request.Do( res, body, err := request.Do(
"/build", "/build",
request.Host(d.Sock()), request.Host(client.DaemonHost()),
request.Method(http.MethodPost), request.Method(http.MethodPost),
request.RawContent(fctx.AsTarReader(t)), request.RawContent(fctx.AsTarReader(t)),
request.ContentType("application/x-tar")) request.ContentType("application/x-tar"))
@ -87,7 +84,7 @@ func TestBuildWithSession(t *testing.T) {
assert.Check(t, is.Equal(du.BuilderSize, int64(0))) assert.Check(t, is.Equal(du.BuilderSize, int64(0)))
} }
func testBuildWithSession(t *testing.T, client dclient.APIClient, daemonSock string, dir, dockerfile string) (outStr string) { func testBuildWithSession(t *testing.T, client dclient.APIClient, daemonHost string, dir, dockerfile string) (outStr string) {
sess, err := session.NewSession("foo1", "foo") sess, err := session.NewSession("foo1", "foo")
assert.Check(t, err) assert.Check(t, err)
@ -106,7 +103,7 @@ func testBuildWithSession(t *testing.T, client dclient.APIClient, daemonSock str
// FIXME use sock here // FIXME use sock here
res, body, err := request.Do( res, body, err := request.Do(
"/build?remote=client-session&session="+sess.ID(), "/build?remote=client-session&session="+sess.ID(),
request.Host(daemonSock), request.Host(daemonHost),
request.Method(http.MethodPost), request.Method(http.MethodPost),
request.With(func(req *http.Request) error { request.With(func(req *http.Request) error {
req.Body = ioutil.NopCloser(strings.NewReader(dockerfile)) req.Body = ioutil.NopCloser(strings.NewReader(dockerfile))

View file

@ -10,20 +10,17 @@ import (
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/integration/internal/container" "github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/internal/test/daemon"
"github.com/docker/docker/internal/test/fakecontext" "github.com/docker/docker/internal/test/fakecontext"
"github.com/docker/docker/pkg/stdcopy" "github.com/docker/docker/pkg/stdcopy"
"github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp" is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/gotestyourself/gotestyourself/skip"
) )
func TestBuildSquashParent(t *testing.T) { func TestBuildSquashParent(t *testing.T) {
d := daemon.New(t, daemon.WithExperimental) skip.If(t, !testEnv.DaemonInfo.ExperimentalBuild)
d.StartWithBusybox(t)
defer d.Stop(t)
client, err := d.NewClient() client := testEnv.APIClient()
assert.NilError(t, err)
dockerfile := ` dockerfile := `
FROM busybox FROM busybox

View file

@ -27,7 +27,7 @@ import (
// the container process, then start dockerd back up and attempt to start the // the container process, then start dockerd back up and attempt to start the
// container again. // container again.
func TestContainerStartOnDaemonRestart(t *testing.T) { func TestContainerStartOnDaemonRestart(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon(), "cannot start daemon on remote test run") skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
t.Parallel() t.Parallel()
d := daemon.New(t) d := daemon.New(t)

View file

@ -14,7 +14,7 @@ import (
) )
func TestDaemonRestartKillContainers(t *testing.T) { func TestDaemonRestartKillContainers(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon(), "cannot start daemon on remote test run") skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
type testCase struct { type testCase struct {
desc string desc string
config *container.Config config *container.Config

View file

@ -50,7 +50,7 @@ func ContainerPoll(config *poll.Settings) {
// NewSwarm creates a swarm daemon for testing // NewSwarm creates a swarm daemon for testing
func NewSwarm(t *testing.T, testEnv *environment.Execution, ops ...func(*daemon.Daemon)) *daemon.Daemon { func NewSwarm(t *testing.T, testEnv *environment.Execution, ops ...func(*daemon.Daemon)) *daemon.Daemon {
t.Helper() t.Helper()
skip.IfCondition(t, testEnv.IsRemoteDaemon()) skip.If(t, testEnv.IsRemoteDaemon)
if testEnv.DaemonInfo.ExperimentalBuild { if testEnv.DaemonInfo.ExperimentalBuild {
ops = append(ops, daemon.WithExperimental) ops = append(ops, daemon.WithExperimental)
} }

View file

@ -47,7 +47,7 @@ func TestMain(m *testing.M) {
} }
func setupTest(t *testing.T) func() { func setupTest(t *testing.T) func() {
skip.IfCondition(t, testEnv.IsRemoteDaemon(), "cannot run daemon when remote daemon") skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
environment.ProtectAll(t, testEnv) environment.ProtectAll(t, testEnv)
d = daemon.New(t, daemon.WithExperimental) d = daemon.New(t, daemon.WithExperimental)

View file

@ -46,7 +46,7 @@ type graphEventsCounter struct {
func TestExternalGraphDriver(t *testing.T) { func TestExternalGraphDriver(t *testing.T) {
skip.If(t, runtime.GOOS == "windows") skip.If(t, runtime.GOOS == "windows")
skip.If(t, testEnv.IsRemoteDaemon(), "cannot run daemon when remote daemon") skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
skip.If(t, !requirement.HasHubConnectivity(t)) skip.If(t, !requirement.HasHubConnectivity(t))
// Setup plugin(s) // Setup plugin(s)
@ -405,7 +405,7 @@ func testGraphDriverPull(c client.APIClient, d *daemon.Daemon) func(*testing.T)
func TestGraphdriverPluginV2(t *testing.T) { func TestGraphdriverPluginV2(t *testing.T) {
skip.If(t, runtime.GOOS == "windows") skip.If(t, runtime.GOOS == "windows")
skip.If(t, testEnv.IsRemoteDaemon(), "cannot run daemon when remote daemon") skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
skip.If(t, !requirement.HasHubConnectivity(t)) skip.If(t, !requirement.HasHubConnectivity(t))
skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64") skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64")
skip.If(t, !requirement.Overlay2Supported(testEnv.DaemonInfo.KernelVersion)) skip.If(t, !requirement.Overlay2Supported(testEnv.DaemonInfo.KernelVersion))

View file

@ -14,7 +14,7 @@ import (
// Ensure that a daemon with a log plugin set as the default logger for containers // Ensure that a daemon with a log plugin set as the default logger for containers
// does not keep the daemon from starting. // does not keep the daemon from starting.
func TestDaemonStartWithLogOpt(t *testing.T) { func TestDaemonStartWithLogOpt(t *testing.T) {
skip.IfCondition(t, testEnv.IsRemoteDaemon(), "cannot run daemon when remote daemon") skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
t.Parallel() t.Parallel()
d := daemon.New(t) d := daemon.New(t)

View file

@ -10,11 +10,13 @@ import (
"github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/internal/test/daemon"
"github.com/docker/docker/internal/test/fixtures/plugin" "github.com/docker/docker/internal/test/fixtures/plugin"
"github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/assert"
"github.com/gotestyourself/gotestyourself/skip"
) )
// TestPluginWithDevMounts tests very specific regression caused by mounts ordering // TestPluginWithDevMounts tests very specific regression caused by mounts ordering
// (sorted in the daemon). See #36698 // (sorted in the daemon). See #36698
func TestPluginWithDevMounts(t *testing.T) { func TestPluginWithDevMounts(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
t.Parallel() t.Parallel()
d := daemon.New(t) d := daemon.New(t)

View file

@ -21,6 +21,7 @@ import (
) )
func TestServicePlugin(t *testing.T) { func TestServicePlugin(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
skip.If(t, testEnv.DaemonInfo.OSType == "windows") skip.If(t, testEnv.DaemonInfo.OSType == "windows")
skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64") skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64")
defer setupTest(t)() defer setupTest(t)()

View file

@ -16,9 +16,11 @@ import (
"github.com/google/go-cmp/cmp/cmpopts" "github.com/google/go-cmp/cmp/cmpopts"
"github.com/gotestyourself/gotestyourself/assert" "github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp" is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/gotestyourself/gotestyourself/skip"
) )
func TestVolumesCreateAndList(t *testing.T) { func TestVolumesCreateAndList(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
defer setupTest(t)() defer setupTest(t)()
client := request.NewAPIClient(t) client := request.NewAPIClient(t)
ctx := context.Background() ctx := context.Background()