Open kalman opened 7 years ago
I wrote this test. Should it fail?
func TestUseAfterClose(t *testing.T) { assert := assert.New(t) dir, err := ioutil.TempDir("", "test") assert.NoError(err) defer os.RemoveAll(dir) cs := nbs.NewLocalStore(dir, 1<<28) db := datas.NewDatabase(cs) defer db.Close() ds := func() datas.Dataset { return db.GetDataset("ds") } // Can correctly commit and read when open. _, err = db.CommitValue(ds(), types.Number(1)) assert.NoError(err) assert.True(types.Number(1).Equals(ds().HeadValue())) // Close... err = db.Close() assert.NoError(err) // It's closed, so shouldn't this fail? _, err = db.CommitValue(ds(), types.Number(2)) assert.NoError(err) assert.True(types.Number(2).Equals(ds().HeadValue())) }
CC @rafael-atticlabs
Probably
The question is where we should block this. At the NomsBlockStore layer, Database, or somewhere in between
I wrote this test. Should it fail?
CC @rafael-atticlabs