Skip to content

Commit

Permalink
Merge pull request #177 from ipfs/test/faster
Browse files Browse the repository at this point in the history
speedup tests
  • Loading branch information
Stebalien authored Jul 12, 2021
2 parents cb04af7 + 596b37f commit 16185d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion delayed/delayed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ func TestDelayed(t *testing.T) {
}

func TestDelayedAll(t *testing.T) {
dstest.SubtestAll(t, New(datastore.NewMapDatastore(), delay.Fixed(time.Millisecond)))
// Delay for virtually no time, we just want to make sure this works correctly, not that it
// delays anything.
dstest.SubtestAll(t, New(datastore.NewMapDatastore(), delay.Fixed(time.Nanosecond)))
}
10 changes: 9 additions & 1 deletion test/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"runtime"
"testing"

detectrace "github.com/ipfs/go-detect-race"

dstore "github.com/ipfs/go-datastore"
query "github.com/ipfs/go-datastore/query"
)
Expand All @@ -13,7 +15,6 @@ import (
var BasicSubtests = []func(t *testing.T, ds dstore.Datastore){
SubtestBasicPutGet,
SubtestNotFounds,
SubtestCombinations,
SubtestPrefix,
SubtestOrder,
SubtestLimit,
Expand All @@ -23,6 +24,13 @@ var BasicSubtests = []func(t *testing.T, ds dstore.Datastore){
SubtestBasicSync,
}

// Only enable the expensive "combinations" test when not running the race detector.
func init() {
if !detectrace.WithRace() {
BasicSubtests = append(BasicSubtests, SubtestCombinations)
}
}

// BatchSubtests is a list of all basic batching datastore tests.
var BatchSubtests = []func(t *testing.T, ds dstore.Batching){
RunBatchTest,
Expand Down

0 comments on commit 16185d2

Please sign in to comment.