Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make number of series a property of prop test #2130

Merged
merged 3 commits into from
Jan 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/dbnode/storage/shard_race_prop_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build big
//
// Copyright (c) 2018 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -135,17 +133,18 @@ func anyIDs() gopter.Gen {
func TestShardTickWriteRace(t *testing.T) {
parameters := gopter.DefaultTestParameters()
seed := time.Now().UnixNano()
parameters.MinSuccessfulTests = 100
parameters.MinSuccessfulTests = 200
parameters.MaxSize = 10
parameters.Rng = rand.New(rand.NewSource(seed))
properties := gopter.NewProperties(parameters)

properties.Property("Concurrent Tick and Write doesn't deadlock", prop.ForAll(
func(tickBatchSize int) bool {
testShardTickWriteRace(t, int(tickBatchSize))
func(tickBatchSize, numSeries int) bool {
testShardTickWriteRace(t, tickBatchSize, numSeries)
return true
},
gen.IntRange(1, 10).WithLabel("tickBatchSize"),
gen.IntRange(1, 100).WithLabel("tickBatchSize"),
gen.IntRange(1, 100).WithLabel("numSeries"),
justinjc marked this conversation as resolved.
Show resolved Hide resolved
))

reporter := gopter.NewFormatedReporter(true, 160, os.Stdout)
Expand All @@ -154,15 +153,15 @@ func TestShardTickWriteRace(t *testing.T) {
}
}

func testShardTickWriteRace(t *testing.T, tickBatchSize int) {
func testShardTickWriteRace(t *testing.T, tickBatchSize, numSeries int) {
shard, opts := propTestDatabaseShard(t, tickBatchSize)
defer func() {
shard.Close()
opts.RuntimeOptionsManager().Close()
}()

ids := []ident.ID{}
for i := 0; i < 10; i++ {
for i := 0; i < numSeries; i++ {
ids = append(ids, ident.StringID(fmt.Sprintf("foo.%d", i)))
}

Expand Down