Skip some tests in certain condition to run with e2e image

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: e55d6fc8573580f6eea009cd7f1034aa912128ef
Component: engine
This commit is contained in:
Vincent Demeester
2018-03-29 09:10:39 +02:00
parent 39837033f0
commit 28e52cd76e
16 changed files with 58 additions and 31 deletions
@@ -17,6 +17,7 @@ import (
type testingT interface {
assert.TestingT
logT
skipT
Fatal(args ...interface{})
Fatalf(string, ...interface{})
}
@@ -25,6 +26,10 @@ type logT interface {
Logf(string, ...interface{})
}
type skipT interface {
Skip(reason string)
}
type gitServer interface {
URL() string
Close() error
@@ -23,6 +23,7 @@ var testEnv *environment.Execution
type testingT interface {
assert.TestingT
logT
skipT
Fatal(args ...interface{})
Fatalf(string, ...interface{})
}
@@ -31,6 +32,10 @@ type logT interface {
Logf(string, ...interface{})
}
type skipT interface {
Skip(reason string)
}
// Fake is a static file server. It might be running locally or remotely
// on test host.
type Fake interface {
@@ -51,10 +56,15 @@ func New(t testingT, dir string, modifiers ...func(*fakecontext.Fake) error) Fak
t.Fatal("fakstorage package requires SetTestEnvironment() to be called before use.")
}
ctx := fakecontext.New(t, dir, modifiers...)
if testEnv.IsLocalDaemon() {
switch {
case testEnv.IsRemoteDaemon() && strings.HasPrefix(request.DaemonHost(), "unix:///"):
t.Skip(fmt.Sprintf("e2e run : daemon is remote but docker host points to a unix socket"))
case testEnv.IsLocalDaemon():
return newLocalFakeStorage(ctx)
default:
return newRemoteFileServer(t, ctx)
}
return newRemoteFileServer(t, ctx)
return nil
}
// localFileStorage is a file storage on the running machine
@@ -152,7 +162,6 @@ COPY . /static`); err != nil {
if err != nil {
t.Fatalf("unable to parse daemon host URL: %v", err)
}
host, _, err := net.SplitHostPort(dockerHostURL.Host)
if err != nil {
t.Fatalf("unable to parse docker daemon host:port: %v", err)
@@ -1713,7 +1713,9 @@ func (s *DockerSuite) TestContainersAPICreateMountsValidation(c *check.C) {
Type: "bind",
Source: notExistPath,
Target: destPath}}},
msg: "bind mount source path does not exist: " + notExistPath,
msg: "source path does not exist",
// FIXME(vdemeester) fails into e2e, migrate to integration/container anyway
// msg: "bind mount source path does not exist: " + notExistPath,
},
{
config: containertypes.Config{
@@ -115,7 +115,14 @@ func (s *DockerSuite) TestAPIImagesHistory(c *check.C) {
c.Assert(err, checker.IsNil)
c.Assert(historydata, checker.Not(checker.HasLen), 0)
c.Assert(historydata[0].Tags[0], checker.Equals, "test-api-images-history:latest")
var found bool
for _, tag := range historydata[0].Tags {
if tag == "test-api-images-history:latest" {
found = true
break
}
}
c.Assert(found, checker.True)
}
func (s *DockerSuite) TestAPIImagesImportBadSrc(c *check.C) {
@@ -93,7 +93,6 @@ func (s *DockerSuite) TestLogsAPIContainerNotFound(c *check.C) {
func (s *DockerSuite) TestLogsAPIUntilFutureFollow(c *check.C) {
testRequires(c, DaemonIsLinux)
name := "logsuntilfuturefollow"
dockerCmd(c, "run", "-d", "--name", name, "busybox", "/bin/sh", "-c", "while true; do date +%s; sleep 1; done")
c.Assert(waitRun(name), checker.IsNil)
@@ -103,7 +102,7 @@ func (s *DockerSuite) TestLogsAPIUntilFutureFollow(c *check.C) {
c.Assert(err, checker.IsNil)
until := daemonTime(c).Add(untilDur)
client, err := request.NewClient()
client, err := client.NewEnvClient()
if err != nil {
c.Fatal(err)
}
@@ -153,7 +152,7 @@ func (s *DockerSuite) TestLogsAPIUntil(c *check.C) {
name := "logsuntil"
dockerCmd(c, "run", "--name", name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do echo log$i; sleep 1; done")
client, err := request.NewClient()
client, err := client.NewEnvClient()
if err != nil {
c.Fatal(err)
}
@@ -190,7 +189,7 @@ func (s *DockerSuite) TestLogsAPIUntilDefaultValue(c *check.C) {
name := "logsuntildefaultval"
dockerCmd(c, "run", "--name", name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do echo log$i; done")
client, err := request.NewClient()
client, err := client.NewEnvClient()
if err != nil {
c.Fatal(err)
}
@@ -1050,7 +1050,7 @@ func (s *DockerSuite) TestBuildAddBadLinksVolume(c *check.C) {
// Issue #5270 - ensure we throw a better error than "unexpected EOF"
// when we can't access files in the context.
func (s *DockerSuite) TestBuildWithInaccessibleFilesInContext(c *check.C) {
testRequires(c, DaemonIsLinux, UnixCli) // test uses chown/chmod: not available on windows
testRequires(c, DaemonIsLinux, UnixCli, SameHostDaemon) // test uses chown/chmod: not available on windows
{
name := "testbuildinaccessiblefiles"
@@ -379,7 +379,7 @@ func (s *DockerSuite) TestCpSymlinkComponent(c *check.C) {
// Check that cp with unprivileged user doesn't return any error
func (s *DockerSuite) TestCpUnprivilegedUser(c *check.C) {
testRequires(c, DaemonIsLinux)
testRequires(c, DaemonIsLinux, SameHostDaemon)
testRequires(c, UnixCli) // uses chmod/su: not available on windows
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "touch "+cpTestName)
@@ -563,6 +563,8 @@ func (s *DockerRegistrySuite) TestEventsImageFilterPush(c *check.C) {
}
func (s *DockerSuite) TestEventsFilterType(c *check.C) {
// FIXME(vdemeester) fails on e2e run
testRequires(c, SameHostDaemon)
since := daemonUnixTime(c)
name := "labelfiltertest"
label := "io.docker.testing=image"
@@ -347,7 +347,7 @@ func (s *DockerExternalGraphdriverSuite) TearDownSuite(c *check.C) {
}
func (s *DockerExternalGraphdriverSuite) TestExternalGraphDriver(c *check.C) {
testRequires(c, ExperimentalDaemon)
testRequires(c, ExperimentalDaemon, SameHostDaemon)
s.testExternalGraphDriver("test-external-graph-driver", "spec", c)
s.testExternalGraphDriver("json-external-graph-driver", "json", c)
@@ -395,7 +395,7 @@ func (s *DockerExternalGraphdriverSuite) testExternalGraphDriver(name string, ex
}
func (s *DockerExternalGraphdriverSuite) TestExternalGraphDriverPull(c *check.C) {
testRequires(c, Network, ExperimentalDaemon)
testRequires(c, Network, ExperimentalDaemon, SameHostDaemon)
s.d.Start(c)
@@ -36,7 +36,7 @@ func checkKernelMajorVersionGreaterOrEqualThen(kernelVersion int, majorVersion i
func (s *DockerNetworkSuite) TestDockerNetworkIpvlanPersistance(c *check.C) {
// verify the driver automatically provisions the 802.1q link (di-dummy0.70)
testRequires(c, DaemonIsLinux, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon)
testRequires(c, DaemonIsLinux, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon, SameHostDaemon)
// master dummy interface 'di' notation represent 'docker ipvlan'
master := "di-dummy0"
// simulate the master link the vlan tagged subinterface parent link will use
@@ -54,7 +54,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkIpvlanPersistance(c *check.C) {
func (s *DockerNetworkSuite) TestDockerNetworkIpvlanSubIntCreate(c *check.C) {
// verify the driver automatically provisions the 802.1q link (di-dummy0.50)
testRequires(c, DaemonIsLinux, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon)
testRequires(c, DaemonIsLinux, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon, SameHostDaemon)
// master dummy interface 'dm' abbreviation represents 'docker ipvlan'
master := "di-dummy0"
// simulate the master link the vlan tagged subinterface parent link will use
@@ -68,7 +68,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkIpvlanSubIntCreate(c *check.C) {
func (s *DockerNetworkSuite) TestDockerNetworkIpvlanOverlapParent(c *check.C) {
// verify the same parent interface cannot be used if already in use by an existing network
testRequires(c, DaemonIsLinux, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon)
testRequires(c, DaemonIsLinux, ipvlanKernelSupport, NotUserNamespace, NotArm, ExperimentalDaemon, SameHostDaemon)
// master dummy interface 'dm' abbreviation represents 'docker ipvlan'
master := "di-dummy0"
createMasterDummy(c, master)