Skip to content

Commit

Permalink
manifest: reduce test size under race
Browse files Browse the repository at this point in the history
  • Loading branch information
RaduBerinde committed Jul 14, 2023
1 parent 10d9e4a commit 9976c78
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/manifest/btree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

"github.com/cockroachdb/errors"
"github.com/cockroachdb/pebble/internal/base"
"github.com/cockroachdb/pebble/internal/invariants"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -586,13 +587,18 @@ func TestAnnotationOrderStatistic(t *testing.T) {
// operations, checking for equivalence with a map of filenums.
func TestRandomizedBTree(t *testing.T) {
const maxFileNum = 50_000
const maxNumOps = 50_000

seed := time.Now().UnixNano()
t.Log("seed", seed)
rng := rand.New(rand.NewSource(seed))

numOps := 10_000 + rng.Intn(maxNumOps-10_000)
var numOps int
if invariants.RaceEnabled {
// Reduce the number of ops in race mode so the test doesn't take very long.
numOps = 1_000 + rng.Intn(4_000)
} else {
numOps = 10_000 + rng.Intn(40_000)
}

var metadataAlloc [maxFileNum]FileMetadata
for i := 0; i < len(metadataAlloc); i++ {
Expand Down

0 comments on commit 9976c78

Please sign in to comment.