perkeep/pkg/test/testdep.go

35 lines
1.0 KiB
Go
Raw Normal View History

Add SKIP_DEP_TESTS env var to skip tests with depdendencies. Now all tests pass like this: bradmac-2:camlistore.org $ SKIP_DEP_TESTS=1 go test ./pkg/... ? camlistore.org/pkg/auth [no test files] ok camlistore.org/pkg/blobref 0.023s ok camlistore.org/pkg/blobserver 0.032s ? camlistore.org/pkg/blobserver/cond [no test files] ? camlistore.org/pkg/blobserver/google [no test files] ok camlistore.org/pkg/blobserver/handlers 0.031s ok camlistore.org/pkg/blobserver/localdisk 1.693s ? camlistore.org/pkg/blobserver/remote [no test files] ? camlistore.org/pkg/blobserver/replica [no test files] ? camlistore.org/pkg/blobserver/s3 [no test files] ? camlistore.org/pkg/blobserver/shard [no test files] ? camlistore.org/pkg/cacher [no test files] ok camlistore.org/pkg/client 0.029s ? camlistore.org/pkg/errorutil [no test files] ? camlistore.org/pkg/fileembed [no test files] ? camlistore.org/pkg/fileembed/genfileembed [no test files] ? camlistore.org/pkg/fs [no test files] ok camlistore.org/pkg/googlestorage 0.034s ? camlistore.org/pkg/httputil [no test files] ok camlistore.org/pkg/index 0.298s ? camlistore.org/pkg/index/indextest [no test files] ok camlistore.org/pkg/index/mongo 0.524s ok camlistore.org/pkg/index/mysql 0.020s ok camlistore.org/pkg/jsonconfig 0.022s ok camlistore.org/pkg/jsonsign 0.155s ok camlistore.org/pkg/lru 0.015s ok camlistore.org/pkg/magic 0.030s ? camlistore.org/pkg/misc [no test files] ok camlistore.org/pkg/misc/amazon/s3 0.028s ok camlistore.org/pkg/misc/gpgagent 0.018s ok camlistore.org/pkg/misc/httprange 0.026s ? camlistore.org/pkg/misc/pinentry [no test files] ? camlistore.org/pkg/misc/resize [no test files] ok camlistore.org/pkg/netutil 0.088s ok camlistore.org/pkg/osutil 0.016s ok camlistore.org/pkg/rollsum 0.027s ok camlistore.org/pkg/schema 0.017s ok camlistore.org/pkg/search 0.016s ok camlistore.org/pkg/server 0.039s ok camlistore.org/pkg/serverconfig 0.031s ? camlistore.org/pkg/test [no test files] ? camlistore.org/pkg/test/asserts [no test files] ? camlistore.org/pkg/test/testdep [no test files] ? camlistore.org/pkg/webserver [no test files] Change-Id: I9c9b0ee4f51cbcf785aed665bbb494339dd84261
2012-03-30 01:21:37 +00:00
/*
Copyright 2012 The Perkeep Authors
Add SKIP_DEP_TESTS env var to skip tests with depdendencies. Now all tests pass like this: bradmac-2:camlistore.org $ SKIP_DEP_TESTS=1 go test ./pkg/... ? camlistore.org/pkg/auth [no test files] ok camlistore.org/pkg/blobref 0.023s ok camlistore.org/pkg/blobserver 0.032s ? camlistore.org/pkg/blobserver/cond [no test files] ? camlistore.org/pkg/blobserver/google [no test files] ok camlistore.org/pkg/blobserver/handlers 0.031s ok camlistore.org/pkg/blobserver/localdisk 1.693s ? camlistore.org/pkg/blobserver/remote [no test files] ? camlistore.org/pkg/blobserver/replica [no test files] ? camlistore.org/pkg/blobserver/s3 [no test files] ? camlistore.org/pkg/blobserver/shard [no test files] ? camlistore.org/pkg/cacher [no test files] ok camlistore.org/pkg/client 0.029s ? camlistore.org/pkg/errorutil [no test files] ? camlistore.org/pkg/fileembed [no test files] ? camlistore.org/pkg/fileembed/genfileembed [no test files] ? camlistore.org/pkg/fs [no test files] ok camlistore.org/pkg/googlestorage 0.034s ? camlistore.org/pkg/httputil [no test files] ok camlistore.org/pkg/index 0.298s ? camlistore.org/pkg/index/indextest [no test files] ok camlistore.org/pkg/index/mongo 0.524s ok camlistore.org/pkg/index/mysql 0.020s ok camlistore.org/pkg/jsonconfig 0.022s ok camlistore.org/pkg/jsonsign 0.155s ok camlistore.org/pkg/lru 0.015s ok camlistore.org/pkg/magic 0.030s ? camlistore.org/pkg/misc [no test files] ok camlistore.org/pkg/misc/amazon/s3 0.028s ok camlistore.org/pkg/misc/gpgagent 0.018s ok camlistore.org/pkg/misc/httprange 0.026s ? camlistore.org/pkg/misc/pinentry [no test files] ? camlistore.org/pkg/misc/resize [no test files] ok camlistore.org/pkg/netutil 0.088s ok camlistore.org/pkg/osutil 0.016s ok camlistore.org/pkg/rollsum 0.027s ok camlistore.org/pkg/schema 0.017s ok camlistore.org/pkg/search 0.016s ok camlistore.org/pkg/server 0.039s ok camlistore.org/pkg/serverconfig 0.031s ? camlistore.org/pkg/test [no test files] ? camlistore.org/pkg/test/asserts [no test files] ? camlistore.org/pkg/test/testdep [no test files] ? camlistore.org/pkg/webserver [no test files] Change-Id: I9c9b0ee4f51cbcf785aed665bbb494339dd84261
2012-03-30 01:21:37 +00:00
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package test
Add SKIP_DEP_TESTS env var to skip tests with depdendencies. Now all tests pass like this: bradmac-2:camlistore.org $ SKIP_DEP_TESTS=1 go test ./pkg/... ? camlistore.org/pkg/auth [no test files] ok camlistore.org/pkg/blobref 0.023s ok camlistore.org/pkg/blobserver 0.032s ? camlistore.org/pkg/blobserver/cond [no test files] ? camlistore.org/pkg/blobserver/google [no test files] ok camlistore.org/pkg/blobserver/handlers 0.031s ok camlistore.org/pkg/blobserver/localdisk 1.693s ? camlistore.org/pkg/blobserver/remote [no test files] ? camlistore.org/pkg/blobserver/replica [no test files] ? camlistore.org/pkg/blobserver/s3 [no test files] ? camlistore.org/pkg/blobserver/shard [no test files] ? camlistore.org/pkg/cacher [no test files] ok camlistore.org/pkg/client 0.029s ? camlistore.org/pkg/errorutil [no test files] ? camlistore.org/pkg/fileembed [no test files] ? camlistore.org/pkg/fileembed/genfileembed [no test files] ? camlistore.org/pkg/fs [no test files] ok camlistore.org/pkg/googlestorage 0.034s ? camlistore.org/pkg/httputil [no test files] ok camlistore.org/pkg/index 0.298s ? camlistore.org/pkg/index/indextest [no test files] ok camlistore.org/pkg/index/mongo 0.524s ok camlistore.org/pkg/index/mysql 0.020s ok camlistore.org/pkg/jsonconfig 0.022s ok camlistore.org/pkg/jsonsign 0.155s ok camlistore.org/pkg/lru 0.015s ok camlistore.org/pkg/magic 0.030s ? camlistore.org/pkg/misc [no test files] ok camlistore.org/pkg/misc/amazon/s3 0.028s ok camlistore.org/pkg/misc/gpgagent 0.018s ok camlistore.org/pkg/misc/httprange 0.026s ? camlistore.org/pkg/misc/pinentry [no test files] ? camlistore.org/pkg/misc/resize [no test files] ok camlistore.org/pkg/netutil 0.088s ok camlistore.org/pkg/osutil 0.016s ok camlistore.org/pkg/rollsum 0.027s ok camlistore.org/pkg/schema 0.017s ok camlistore.org/pkg/search 0.016s ok camlistore.org/pkg/server 0.039s ok camlistore.org/pkg/serverconfig 0.031s ? camlistore.org/pkg/test [no test files] ? camlistore.org/pkg/test/asserts [no test files] ? camlistore.org/pkg/test/testdep [no test files] ? camlistore.org/pkg/webserver [no test files] Change-Id: I9c9b0ee4f51cbcf785aed665bbb494339dd84261
2012-03-30 01:21:37 +00:00
import (
"os"
"strconv"
"testing"
)
// DependencyErrorOrSkip is called when a test's dependency
// isn't found. It either skips the current test (if SKIP_DEP_TESTS is set),
// or calls t.Error with an error.
func DependencyErrorOrSkip(t *testing.T) {
Add SKIP_DEP_TESTS env var to skip tests with depdendencies. Now all tests pass like this: bradmac-2:camlistore.org $ SKIP_DEP_TESTS=1 go test ./pkg/... ? camlistore.org/pkg/auth [no test files] ok camlistore.org/pkg/blobref 0.023s ok camlistore.org/pkg/blobserver 0.032s ? camlistore.org/pkg/blobserver/cond [no test files] ? camlistore.org/pkg/blobserver/google [no test files] ok camlistore.org/pkg/blobserver/handlers 0.031s ok camlistore.org/pkg/blobserver/localdisk 1.693s ? camlistore.org/pkg/blobserver/remote [no test files] ? camlistore.org/pkg/blobserver/replica [no test files] ? camlistore.org/pkg/blobserver/s3 [no test files] ? camlistore.org/pkg/blobserver/shard [no test files] ? camlistore.org/pkg/cacher [no test files] ok camlistore.org/pkg/client 0.029s ? camlistore.org/pkg/errorutil [no test files] ? camlistore.org/pkg/fileembed [no test files] ? camlistore.org/pkg/fileembed/genfileembed [no test files] ? camlistore.org/pkg/fs [no test files] ok camlistore.org/pkg/googlestorage 0.034s ? camlistore.org/pkg/httputil [no test files] ok camlistore.org/pkg/index 0.298s ? camlistore.org/pkg/index/indextest [no test files] ok camlistore.org/pkg/index/mongo 0.524s ok camlistore.org/pkg/index/mysql 0.020s ok camlistore.org/pkg/jsonconfig 0.022s ok camlistore.org/pkg/jsonsign 0.155s ok camlistore.org/pkg/lru 0.015s ok camlistore.org/pkg/magic 0.030s ? camlistore.org/pkg/misc [no test files] ok camlistore.org/pkg/misc/amazon/s3 0.028s ok camlistore.org/pkg/misc/gpgagent 0.018s ok camlistore.org/pkg/misc/httprange 0.026s ? camlistore.org/pkg/misc/pinentry [no test files] ? camlistore.org/pkg/misc/resize [no test files] ok camlistore.org/pkg/netutil 0.088s ok camlistore.org/pkg/osutil 0.016s ok camlistore.org/pkg/rollsum 0.027s ok camlistore.org/pkg/schema 0.017s ok camlistore.org/pkg/search 0.016s ok camlistore.org/pkg/server 0.039s ok camlistore.org/pkg/serverconfig 0.031s ? camlistore.org/pkg/test [no test files] ? camlistore.org/pkg/test/asserts [no test files] ? camlistore.org/pkg/test/testdep [no test files] ? camlistore.org/pkg/webserver [no test files] Change-Id: I9c9b0ee4f51cbcf785aed665bbb494339dd84261
2012-03-30 01:21:37 +00:00
b, _ := strconv.ParseBool(os.Getenv("SKIP_DEP_TESTS"))
if b {
t.Skip("SKIP_DEP_TESTS is set; skipping test.")
Add SKIP_DEP_TESTS env var to skip tests with depdendencies. Now all tests pass like this: bradmac-2:camlistore.org $ SKIP_DEP_TESTS=1 go test ./pkg/... ? camlistore.org/pkg/auth [no test files] ok camlistore.org/pkg/blobref 0.023s ok camlistore.org/pkg/blobserver 0.032s ? camlistore.org/pkg/blobserver/cond [no test files] ? camlistore.org/pkg/blobserver/google [no test files] ok camlistore.org/pkg/blobserver/handlers 0.031s ok camlistore.org/pkg/blobserver/localdisk 1.693s ? camlistore.org/pkg/blobserver/remote [no test files] ? camlistore.org/pkg/blobserver/replica [no test files] ? camlistore.org/pkg/blobserver/s3 [no test files] ? camlistore.org/pkg/blobserver/shard [no test files] ? camlistore.org/pkg/cacher [no test files] ok camlistore.org/pkg/client 0.029s ? camlistore.org/pkg/errorutil [no test files] ? camlistore.org/pkg/fileembed [no test files] ? camlistore.org/pkg/fileembed/genfileembed [no test files] ? camlistore.org/pkg/fs [no test files] ok camlistore.org/pkg/googlestorage 0.034s ? camlistore.org/pkg/httputil [no test files] ok camlistore.org/pkg/index 0.298s ? camlistore.org/pkg/index/indextest [no test files] ok camlistore.org/pkg/index/mongo 0.524s ok camlistore.org/pkg/index/mysql 0.020s ok camlistore.org/pkg/jsonconfig 0.022s ok camlistore.org/pkg/jsonsign 0.155s ok camlistore.org/pkg/lru 0.015s ok camlistore.org/pkg/magic 0.030s ? camlistore.org/pkg/misc [no test files] ok camlistore.org/pkg/misc/amazon/s3 0.028s ok camlistore.org/pkg/misc/gpgagent 0.018s ok camlistore.org/pkg/misc/httprange 0.026s ? camlistore.org/pkg/misc/pinentry [no test files] ? camlistore.org/pkg/misc/resize [no test files] ok camlistore.org/pkg/netutil 0.088s ok camlistore.org/pkg/osutil 0.016s ok camlistore.org/pkg/rollsum 0.027s ok camlistore.org/pkg/schema 0.017s ok camlistore.org/pkg/search 0.016s ok camlistore.org/pkg/server 0.039s ok camlistore.org/pkg/serverconfig 0.031s ? camlistore.org/pkg/test [no test files] ? camlistore.org/pkg/test/asserts [no test files] ? camlistore.org/pkg/test/testdep [no test files] ? camlistore.org/pkg/webserver [no test files] Change-Id: I9c9b0ee4f51cbcf785aed665bbb494339dd84261
2012-03-30 01:21:37 +00:00
}
t.Error("External test dependencies not found, and environment SKIP_DEP_TESTS not set.")
}