Skip to content

Commit f662088

Browse files
committed
Merge commit 'd6bd1ce' into bug/race-close
2 parents ea48232 + d6bd1ce commit f662088

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ds_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,19 @@ func TestQueryRespectsProcess(t *testing.T) {
147147
addTestCases(t, d, testcases)
148148
}
149149

150+
func TestCloseRace(t *testing.T) {
151+
d, close := newDS(t)
152+
for n := 0; n < 1000; n++ {
153+
d.Put(ds.NewKey(fmt.Sprintf("%d", n)), []byte(fmt.Sprintf("test%d", n)))
154+
}
155+
156+
go close()
157+
tx, _ := d.NewTransaction(false)
158+
for k := range testcases {
159+
tx.Get(ds.NewKey(k))
160+
}
161+
}
162+
150163
func TestQueryRespectsProcessMem(t *testing.T) {
151164
d := newDSMem(t)
152165
addTestCases(t, d, testcases)

0 commit comments

Comments
 (0)