Skip to content

Commit 9086c4b

Browse files
committed
db: reduce numOps in TestWALFailoverRandomized
This reduces run time from 4s to ~1.5s on average.
1 parent 4aab172 commit 9086c4b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

open_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,6 +1778,7 @@ func TestMkdirAllAndSyncParents(t *testing.T) {
17781778
func TestWALFailoverRandomized(t *testing.T) {
17791779
seed := time.Now().UnixNano()
17801780
t.Logf("seed %d", seed)
1781+
rng := rand.New(rand.NewPCG(1, uint64(seed)))
17811782
makeOptions := func(mem *vfs.MemFS) *Options {
17821783
failoverOpts := WALFailoverOptions{
17831784
Secondary: wal.Dir{FS: mem, Dirname: "secondary"},
@@ -1793,8 +1794,8 @@ func TestWALFailoverRandomized(t *testing.T) {
17931794
},
17941795
}
17951796

1796-
mean := time.Duration(rand.ExpFloat64() * float64(time.Microsecond))
1797-
p := rand.Float64()
1797+
mean := time.Duration(rng.ExpFloat64() * float64(time.Microsecond))
1798+
p := rng.Float64()
17981799
t.Logf("Injecting mean %s of latency with p=%.3f", mean, p)
17991800
fs := errorfs.Wrap(mem, errorfs.RandomLatency(errorfs.Randomly(p, seed), mean, seed, time.Second))
18001801
return &Options{
@@ -1806,12 +1807,13 @@ func TestWALFailoverRandomized(t *testing.T) {
18061807
WALFailover: &failoverOpts,
18071808
}
18081809
}
1810+
numOps := int(rand.ExpFloat64() * 200)
18091811
runRandomizedCrashTest(t, randomizedCrashTestOptions{
18101812
makeOptions: makeOptions,
18111813
maxValueSize: 4096,
18121814
seed: seed,
18131815
unsyncedDataPercent: 50,
1814-
numOps: 1000,
1816+
numOps: numOps,
18151817
opCrashWeight: 1,
18161818
opBatchWeight: 20,
18171819
})

0 commit comments

Comments
 (0)