Skip to content

Commit

Permalink
better test
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Mar 4, 2025
1 parent 693d382 commit 05dc62c
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion memiavl/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,26 @@ func TestRepeatedApplyChangeSet(t *testing.T) {
}

func TestIdempotentWrite(t *testing.T) {
for _, asyncCommit := range []bool{false, true} {
t.Run(fmt.Sprintf("asyncCommit=%v", asyncCommit), func(t *testing.T) {
testIdempotentWrite(t, asyncCommit)
})
}
}

func testIdempotentWrite(t *testing.T, asyncCommit bool) {
dir := t.TempDir()
db, err := Load(dir, Options{CreateIfMissing: true, InitialStores: []string{"test1", "test2"}})

asyncCommitBuffer := -1
if asyncCommit {
asyncCommitBuffer = 10
}

db, err := Load(dir, Options{
CreateIfMissing: true,
InitialStores: []string{"test1", "test2"},
AsyncCommitBuffer: asyncCommitBuffer,
})
require.NoError(t, err)

// generate some data into db
Expand Down

0 comments on commit 05dc62c

Please sign in to comment.