From 006ea6bbc5393f6b5e4501714b3d42fe5556001b Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 12 Jul 2021 14:00:49 -0700 Subject: [PATCH 1/2] test: disable expensive query test with race detector It's _really_ slow. We still test queries under the race detector, this is just an exhaustive logic test. --- test/suite.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/suite.go b/test/suite.go index 012f802..4086857 100644 --- a/test/suite.go +++ b/test/suite.go @@ -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" ) @@ -13,7 +15,6 @@ import ( var BasicSubtests = []func(t *testing.T, ds dstore.Datastore){ SubtestBasicPutGet, SubtestNotFounds, - SubtestCombinations, SubtestPrefix, SubtestOrder, SubtestLimit, @@ -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, From 596b37f15340d357e8a6903d139331c675a2211d Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 12 Jul 2021 14:01:29 -0700 Subject: [PATCH 2/2] test: faster delaystore test We don't _actually_ need to delay here. The basic subtests don't even know that things should be delayed. --- delayed/delayed_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/delayed/delayed_test.go b/delayed/delayed_test.go index 4519f82..f1ba769 100644 --- a/delayed/delayed_test.go +++ b/delayed/delayed_test.go @@ -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))) }