mirror of https://github.com/perkeep/perkeep.git
mongo: use SKIP_DEP_TESTS again. regressed in recent refactor.
Noticed because 'make presubmit' was breaking when offline. Change-Id: I1afd12eb2ae8f504018b8a30a91d2d2e87d35999
This commit is contained in:
parent
60e05bf90b
commit
80ea29de8f
|
@ -40,7 +40,18 @@ func checkMongoUp() {
|
||||||
mongoNotAvailable = !mongo.Ping("localhost", 500*time.Millisecond)
|
mongoNotAvailable = !mongo.Ping("localhost", 500*time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func skipOrFailIfNoMongo(t *testing.T) {
|
||||||
|
once.Do(checkMongoUp)
|
||||||
|
if mongoNotAvailable {
|
||||||
|
err := errors.New("Not running; start a mongoDB daemon on the standard port (27017). The \"keys\" collection in the \"camlitest\" database will be used.")
|
||||||
|
test.DependencyErrorOrSkip(t)
|
||||||
|
t.Fatalf("Mongo not available locally for testing: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func newSorted(t *testing.T) (kv sorted.KeyValue, cleanup func()) {
|
func newSorted(t *testing.T) (kv sorted.KeyValue, cleanup func()) {
|
||||||
|
skipOrFailIfNoMongo(t)
|
||||||
|
|
||||||
// connect without credentials and wipe the database
|
// connect without credentials and wipe the database
|
||||||
cfg := jsonconfig.Obj{
|
cfg := jsonconfig.Obj{
|
||||||
"host": "localhost",
|
"host": "localhost",
|
||||||
|
@ -73,12 +84,7 @@ func TestSortedKV(t *testing.T) {
|
||||||
type mongoTester struct{}
|
type mongoTester struct{}
|
||||||
|
|
||||||
func (mongoTester) test(t *testing.T, tfn func(*testing.T, func() *index.Index)) {
|
func (mongoTester) test(t *testing.T, tfn func(*testing.T, func() *index.Index)) {
|
||||||
once.Do(checkMongoUp)
|
skipOrFailIfNoMongo(t)
|
||||||
if mongoNotAvailable {
|
|
||||||
err := errors.New("Not running; start a mongoDB daemon on the standard port (27017). The \"keys\" collection in the \"camlitest\" database will be used.")
|
|
||||||
test.DependencyErrorOrSkip(t)
|
|
||||||
t.Fatalf("Mongo not available locally for testing: %v", err)
|
|
||||||
}
|
|
||||||
defer test.TLog(t)()
|
defer test.TLog(t)()
|
||||||
var cleanups []func()
|
var cleanups []func()
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|
Loading…
Reference in New Issue