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 4
4
5
5
require (
6
6
github.com/google/uuid v1.6.0
7
+ github.com/ipfs/go-detect-race v0.0.1
7
8
github.com/ipfs/go-ipfs-delay v0.0.1
8
9
go.opentelemetry.io/otel v1.16.0
9
10
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=
9
9
github.com/google/go-cmp v0.5.9 /go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY =
10
10
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0 =
11
11
github.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 =
12
14
github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ =
13
15
github.com/ipfs/go-ipfs-delay v0.0.1 /go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw =
14
16
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs =
Original file line number Diff line number Diff line change @@ -11,13 +11,22 @@ import (
11
11
12
12
dstore "github.com/ipfs/go-datastore"
13
13
dsq "github.com/ipfs/go-datastore/query"
14
+ detectrace "github.com/ipfs/go-detect-race"
14
15
)
15
16
16
17
// ElemCount sets with how many elements the datastore suit
17
18
// tests are usually run with. Best to set to round numbers like
18
19
// 20, 30, 40... and at least to 20.
19
20
var ElemCount = 100
20
21
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
+
21
30
func TestElemCount (t * testing.T ) {
22
31
if ElemCount < 20 {
23
32
t .Fatal ("ElemCount should be set to 20 at least" )
Original file line number Diff line number Diff line change 8
8
9
9
dstore "github.com/ipfs/go-datastore"
10
10
query "github.com/ipfs/go-datastore/query"
11
+ detectrace "github.com/ipfs/go-detect-race"
11
12
)
12
13
13
14
// BasicSubtests is a list of all basic tests.
@@ -21,7 +22,13 @@ var BasicSubtests = []func(t *testing.T, ds dstore.Datastore){
21
22
SubtestManyKeysAndQuery ,
22
23
SubtestReturnSizes ,
23
24
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
+ }
25
32
}
26
33
27
34
// BatchSubtests is a list of all basic batching datastore tests.
You can’t perform that action at this time.
0 commit comments