mirror of https://github.com/restic/restic.git
Travis: Skip cloud backend tests for most Go versions
This commit is contained in:
parent
b077a1227b
commit
b3a073e066
37
.travis.yml
37
.travis.yml
|
@ -1,33 +1,24 @@
|
||||||
language: go
|
language: go
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
go:
|
|
||||||
- "1.8.x"
|
|
||||||
- "1.9.x"
|
|
||||||
- "1.10"
|
|
||||||
|
|
||||||
os:
|
|
||||||
- linux
|
|
||||||
- osx
|
|
||||||
|
|
||||||
env:
|
|
||||||
matrix:
|
matrix:
|
||||||
RESTIC_TEST_FUSE=0
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
exclude:
|
|
||||||
- os: osx
|
|
||||||
go: "1.8.x"
|
|
||||||
- os: osx
|
|
||||||
go: "1.9.x"
|
|
||||||
- os: linux
|
|
||||||
go: "1.10"
|
|
||||||
include:
|
include:
|
||||||
- os: linux
|
- os: linux
|
||||||
go: "1.10"
|
go: "1.8.x"
|
||||||
|
env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
go: "1.9.x"
|
||||||
|
env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0
|
||||||
|
|
||||||
|
# only run fuse and cloud backends tests on Travis for the latest Go on Linux
|
||||||
|
- os: linux
|
||||||
|
go: "1.10.x"
|
||||||
sudo: true
|
sudo: true
|
||||||
env:
|
|
||||||
RESTIC_TEST_FUSE=1
|
- os: osx
|
||||||
|
go: "1.10.x"
|
||||||
|
env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
|
|
|
@ -25,6 +25,17 @@ var ForbiddenImports = map[string]bool{
|
||||||
"errors": true,
|
"errors": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CloudBackends contains a map of backend tests for cloud services to one
|
||||||
|
// of the essential environment variables which must be present in order to
|
||||||
|
// test it.
|
||||||
|
var CloudBackends = map[string]string{
|
||||||
|
"restic/backend/s3.TestBackendS3": "RESTIC_TEST_S3_REPOSITORY",
|
||||||
|
"restic/backend/swift.TestBackendSwift": "RESTIC_TEST_SWIFT",
|
||||||
|
"restic/backend/b2.TestBackendB2": "RESTIC_TEST_B2_REPOSITORY",
|
||||||
|
"restic/backend/gs.TestBackendGS": "RESTIC_TEST_GS_REPOSITORY",
|
||||||
|
"restic/backend/azure.TestBackendAzure": "RESTIC_TEST_AZURE_REPOSITORY",
|
||||||
|
}
|
||||||
|
|
||||||
var runCrossCompile = flag.Bool("cross-compile", true, "run cross compilation tests")
|
var runCrossCompile = flag.Bool("cross-compile", true, "run cross compilation tests")
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -132,6 +143,18 @@ func (env *TravisEnvironment) Prepare() error {
|
||||||
msg("gox: OS/ARCH %v\n", env.goxOSArch)
|
msg("gox: OS/ARCH %v\n", env.goxOSArch)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// do not run cloud tests on darwin
|
||||||
|
if os.Getenv("RESTIC_TEST_CLOUD_BACKENDS") == "0" {
|
||||||
|
msg("skipping cloud backend tests\n")
|
||||||
|
|
||||||
|
for _, name := range CloudBackends {
|
||||||
|
err := os.Unsetenv(name)
|
||||||
|
if err != nil {
|
||||||
|
msg(" error unsetting %v: %v\n", name, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// extract credentials file for GCS tests
|
// extract credentials file for GCS tests
|
||||||
if b64data := os.Getenv("RESTIC_TEST_GS_APPLICATION_CREDENTIALS_B64"); b64data != "" {
|
if b64data := os.Getenv("RESTIC_TEST_GS_APPLICATION_CREDENTIALS_B64"); b64data != "" {
|
||||||
buf, err := base64.StdEncoding.DecodeString(b64data)
|
buf, err := base64.StdEncoding.DecodeString(b64data)
|
||||||
|
@ -176,12 +199,6 @@ func (env *TravisEnvironment) Teardown() error {
|
||||||
|
|
||||||
// RunTests starts the tests for Travis.
|
// RunTests starts the tests for Travis.
|
||||||
func (env *TravisEnvironment) RunTests() error {
|
func (env *TravisEnvironment) RunTests() error {
|
||||||
// do not run fuse tests on darwin
|
|
||||||
if runtime.GOOS == "darwin" {
|
|
||||||
msg("skip fuse integration tests on %v\n", runtime.GOOS)
|
|
||||||
_ = os.Setenv("RESTIC_TEST_FUSE", "0")
|
|
||||||
}
|
|
||||||
|
|
||||||
env.env["GOPATH"] = os.Getenv("GOPATH")
|
env.env["GOPATH"] = os.Getenv("GOPATH")
|
||||||
if env.gcsCredentialsFile != "" {
|
if env.gcsCredentialsFile != "" {
|
||||||
env.env["GOOGLE_APPLICATION_CREDENTIALS"] = env.gcsCredentialsFile
|
env.env["GOOGLE_APPLICATION_CREDENTIALS"] = env.gcsCredentialsFile
|
||||||
|
@ -195,32 +212,14 @@ func (env *TravisEnvironment) RunTests() error {
|
||||||
"restic/backend/rclone.TestBackendRclone",
|
"restic/backend/rclone.TestBackendRclone",
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the test s3 repository is available, make sure that the test is not skipped
|
// make sure that cloud backends for which we have credentials are not
|
||||||
if os.Getenv("RESTIC_TEST_S3_REPOSITORY") != "" {
|
// silently skipped.
|
||||||
ensureTests = append(ensureTests, "restic/backend/s3.TestBackendS3")
|
for pkg, env := range CloudBackends {
|
||||||
|
if _, ok := os.LookupEnv(env); ok {
|
||||||
|
ensureTests = append(ensureTests, pkg)
|
||||||
} else {
|
} else {
|
||||||
msg("S3 repository not available\n")
|
msg("credentials for %v are not available, skipping\n", pkg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the test swift service is available, make sure that the test is not skipped
|
|
||||||
if os.Getenv("RESTIC_TEST_SWIFT") != "" {
|
|
||||||
ensureTests = append(ensureTests, "restic/backend/swift.TestBackendSwift")
|
|
||||||
} else {
|
|
||||||
msg("Swift service not available\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the test b2 repository is available, make sure that the test is not skipped
|
|
||||||
if os.Getenv("RESTIC_TEST_B2_REPOSITORY") != "" {
|
|
||||||
ensureTests = append(ensureTests, "restic/backend/b2.TestBackendB2")
|
|
||||||
} else {
|
|
||||||
msg("B2 repository not available\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the test gs repository is available, make sure that the test is not skipped
|
|
||||||
if os.Getenv("RESTIC_TEST_GS_REPOSITORY") != "" {
|
|
||||||
ensureTests = append(ensureTests, "restic/backend/gs.TestBackendGS")
|
|
||||||
} else {
|
|
||||||
msg("GS repository not available\n")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
env.env["RESTIC_TEST_DISALLOW_SKIP"] = strings.Join(ensureTests, ",")
|
env.env["RESTIC_TEST_DISALLOW_SKIP"] = strings.Join(ensureTests, ",")
|
||||||
|
|
Loading…
Reference in New Issue