File tree Expand file tree Collapse file tree 4 files changed +20
-1
lines changed Expand file tree Collapse file tree 4 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 44
55require (
66 github.com/google/uuid v1.6.0
7+ github.com/ipfs/go-detect-race v0.0.1
78 github.com/ipfs/go-ipfs-delay v0.0.1
89 go.opentelemetry.io/otel v1.16.0
910 go.opentelemetry.io/otel/trace v1.16.0
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
99github.com/google/go-cmp v0.5.9 /go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY =
1010github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0 =
1111github.com/google/uuid v1.6.0 /go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo =
12+ github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk =
13+ github.com/ipfs/go-detect-race v0.0.1 /go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps =
1214github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ =
1315github.com/ipfs/go-ipfs-delay v0.0.1 /go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw =
1416github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs =
Original file line number Diff line number Diff line change @@ -11,13 +11,22 @@ import (
1111
1212 dstore "github.com/ipfs/go-datastore"
1313 dsq "github.com/ipfs/go-datastore/query"
14+ detectrace "github.com/ipfs/go-detect-race"
1415)
1516
1617// ElemCount sets with how many elements the datastore suit
1718// tests are usually run with. Best to set to round numbers like
1819// 20, 30, 40... and at least to 20.
1920var ElemCount = 100
2021
22+ func init () {
23+ // Reduce the default element count when the race detector is enabled so these tests don't
24+ // take forever.
25+ if detectrace .WithRace () {
26+ ElemCount = 20
27+ }
28+ }
29+
2130func TestElemCount (t * testing.T ) {
2231 if ElemCount < 20 {
2332 t .Fatal ("ElemCount should be set to 20 at least" )
Original file line number Diff line number Diff line change 88
99 dstore "github.com/ipfs/go-datastore"
1010 query "github.com/ipfs/go-datastore/query"
11+ detectrace "github.com/ipfs/go-detect-race"
1112)
1213
1314// BasicSubtests is a list of all basic tests.
@@ -21,7 +22,13 @@ var BasicSubtests = []func(t *testing.T, ds dstore.Datastore){
2122 SubtestManyKeysAndQuery ,
2223 SubtestReturnSizes ,
2324 SubtestBasicSync ,
24- SubtestCombinations ,
25+ }
26+
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+ }
2532}
2633
2734// BatchSubtests is a list of all basic batching datastore tests.
You can’t perform that action at this time.
0 commit comments