Skip to content

Commit 16185d2

Browse files
authored
Merge pull request #177 from ipfs/test/faster
speedup tests
2 parents cb04af7 + 596b37f commit 16185d2

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

delayed/delayed_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,7 @@ func TestDelayed(t *testing.T) {
2727
}
2828

2929
func TestDelayedAll(t *testing.T) {
30-
dstest.SubtestAll(t, New(datastore.NewMapDatastore(), delay.Fixed(time.Millisecond)))
30+
// Delay for virtually no time, we just want to make sure this works correctly, not that it
31+
// delays anything.
32+
dstest.SubtestAll(t, New(datastore.NewMapDatastore(), delay.Fixed(time.Nanosecond)))
3133
}

test/suite.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"runtime"
66
"testing"
77

8+
detectrace "github.com/ipfs/go-detect-race"
9+
810
dstore "github.com/ipfs/go-datastore"
911
query "github.com/ipfs/go-datastore/query"
1012
)
@@ -13,7 +15,6 @@ import (
1315
var BasicSubtests = []func(t *testing.T, ds dstore.Datastore){
1416
SubtestBasicPutGet,
1517
SubtestNotFounds,
16-
SubtestCombinations,
1718
SubtestPrefix,
1819
SubtestOrder,
1920
SubtestLimit,
@@ -23,6 +24,13 @@ var BasicSubtests = []func(t *testing.T, ds dstore.Datastore){
2324
SubtestBasicSync,
2425
}
2526

27+
// Only enable the expensive "combinations" test when not running the race detector.
28+
func init() {
29+
if !detectrace.WithRace() {
30+
BasicSubtests = append(BasicSubtests, SubtestCombinations)
31+
}
32+
}
33+
2634
// BatchSubtests is a list of all basic batching datastore tests.
2735
var BatchSubtests = []func(t *testing.T, ds dstore.Batching){
2836
RunBatchTest,

0 commit comments

Comments
 (0)