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)