tests: expect Docker on AppVeyor

Prepare to run docker on AppVeyor Windows environment
This commit is contained in:
Mahmood Ali
2019-02-20 07:41:47 -05:00
parent 427ab71b47
commit 2af30fb441
2 changed files with 15 additions and 7 deletions

View File

@@ -16,6 +16,10 @@ func DockerIsConnected(t *testing.T) bool {
return runtime.GOOS == "linux"
}
if testutil.IsAppVeyor() {
return runtime.GOOS == "windows"
}
client, err := docker.NewClientFromEnv()
if err != nil {
return false

View File

@@ -10,12 +10,6 @@ import (
"github.com/stretchr/testify/require"
)
const (
// TravisRunEnv is an environment variable that is set if being run by
// Travis.
TravisRunEnv = "CI"
)
type testFn func() (bool, error)
type errorFn func(error)
@@ -69,8 +63,18 @@ func Timeout(original time.Duration) time.Duration {
return original * time.Duration(TestMultiplier())
}
func IsCI() bool {
_, ok := os.LookupEnv("CI")
return ok
}
func IsTravis() bool {
_, ok := os.LookupEnv(TravisRunEnv)
_, ok := os.LookupEnv("TRAVIS")
return ok
}
func IsAppVeyor() bool {
_, ok := os.LookupEnv("APPVEYOR")
return ok
}